Interactive image texture migration conversion method, device, computer equipment and storage medium
Through the feedforward encoder-decoder network architecture of the deep neural network, the problem of low texture migration efficiency in the existing technology is solved, fast and universal image texture migration and conversion is achieved, and the user interaction experience is improved.
Patent Information
- Application Number
- CN202110266870.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-11
- Publication Date
- 2024-09-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The interactive texture transfer method in the existing technology requires the design of specific machine learning models for different tasks, and the algorithm execution efficiency is low, making it difficult to achieve rapid image texture transfer conversion.
The feedforward encoder-decoder network architecture of the deep neural network is used to perform image texture migration through multiple sequentially connected texture migration layers. The encoder and decoder are used to migrate and decode the feature data to achieve the generation of the target image. Avoid backpropagation and other time-consuming operations.
It greatly improves the speed of image texture migration and has good versatility. There is no need to select specific machine learning models for different tasks. Users can quickly and interactively generate high-quality texture migration results.
Smart Images

Figure CN113191936B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of deep learning and image conversion, and in particular to an interactive image texture migration and conversion method, device, computer equipment and storage medium. Background Art
[0002] Interactive texture transfer refers to the migration and editing of textures of a reference stylized source image by users through semantic map interaction. It generally requires three inputs, namely the reference stylized source image, the source semantic map corresponding to the stylized source image, and the target semantic map specified by the user for interactive editing. Users can interactively control the shape, size, and spatial distribution of the target in the stylized source image by editing the target semantic map, thereby achieving the purpose of texture migration and editing.
[0003] In the existing technology, many technologies achieve interactive texture transfer by using traditional machine learning methods, but such methods have problems such as the need to design specific machine learning models for different tasks and low algorithm execution efficiency. Summary of the invention
[0004] Based on this, it is necessary to provide a universal interactive image texture migration conversion method, device, computer equipment and storage medium that can improve the conversion speed in order to solve the above technical problems.
[0005] An interactive image texture migration conversion method, comprising:
[0006] Acquire a target semantic map, a stylized source image, and a source semantic map corresponding to the stylized source image;
[0007] Inputting the target semantic map, the stylized source image and the source semantic map into a deep neural network to obtain a target image, wherein the target image is obtained by performing texture migration conversion on the target semantic map with reference to the stylized source image;
[0008] Among them, the deep neural network includes a plurality of texture migration layers connected in sequence, each of the texture migration layers includes an encoder, a texture migration unit and a decoder, and the output of the texture migration layer is used as one of the inputs of the next connected texture migration layer, until the output result of the texture migration layer of the last layer is used as the target image.
[0009] Optionally, the deep neural network includes five sequentially connected first to fifth texture migration layers, wherein the target semantic map, the stylized source image and the source semantic map serve as inputs of the first texture migration layer, and the target image serves as output of the fifth texture migration layer;
[0010] The encoder includes first to fifth encoders sequentially located at each texture migration layer;
[0011] The decoder comprises first to fifth decoders sequentially located at each texture migration layer;
[0012] The texture migration unit includes a global texture migration unit located in the first texture migration layer, a local texture migration unit located in the second texture migration layer, and a global texture enhancement unit located in the third to fifth texture migration layers.
[0013] Optionally, inputting the target semantic map, the stylized source image, and the source semantic map into a deep neural network to obtain a stylized target image comprises:
[0014] Inputting the target semantic map, the stylized source image, and the source semantic map into a first encoder to obtain corresponding first feature data, performing a global texture migration calculation on the first feature data by the global texture migration unit to obtain first stylized target feature data, and decoding the first stylized target feature data into a first stylized target image by a first decoder;
[0015] Inputting the target semantic map, the stylized source image, the source semantic map, and the first stylized target image into a second encoder to obtain corresponding second feature data, performing texture migration calculation in a local range on the second feature data by the local texture migration unit to obtain second stylized target feature data, and decoding the second stylized target feature data into a second stylized target image by a second decoder;
[0016] Inputting the stylized source image and the second stylized target image into a third encoder to obtain corresponding third feature data, performing a global texture enhancement calculation on the third feature data by the global texture enhancement unit to obtain third stylized target feature data, and decoding the third stylized target feature data into a third stylized target image by a third decoder;
[0017] Inputting the stylized source image and the third stylized target image into a fourth encoder to obtain corresponding fourth feature data, performing a global texture enhancement calculation on the fourth feature data by the global texture enhancement unit to obtain fourth stylized target feature data, and decoding the fourth stylized target feature data into a fourth stylized target image by a fourth decoder;
[0018] The stylized source image and the fourth stylized target image are input into a fifth encoder to obtain corresponding fifth feature data, the global texture enhancement unit performs a global texture enhancement calculation on the fifth feature data to obtain fifth stylized target feature data, and the fifth decoder is used to decode the fifth stylized target feature data into a fifth stylized target image, and the fifth stylized target image is the target image.
[0019] Optionally, the performing a global texture migration calculation on the first feature data by the global texture migration unit to obtain the first stylized target feature data includes:
[0020] Dividing the first feature data into a plurality of first feature data blocks globally;
[0021] Matching the target semantic graph and the plurality of first feature data blocks corresponding to the source semantic graph respectively, to obtain a first index between the plurality of first feature data blocks corresponding to the source semantic graph that best matches the plurality of first feature data blocks corresponding to the target semantic graph;
[0022] The first index is used to reorganize a plurality of first feature data blocks corresponding to the stylized source image to obtain the first stylized target feature data.
[0023] Optionally, the performing texture migration calculation in a local range on the second feature data by the local texture migration unit to obtain the second stylized target feature data includes:
[0024] Fusing the second feature data corresponding to the stylized source image and the source semantic map respectively to obtain source fused feature data;
[0025] Fusing the first stylized target image and the second feature data corresponding to the target semantic map respectively to obtain target fused feature data;
[0026] Dividing the second feature data corresponding to the stylized source image into a plurality of second feature data blocks in a local range, and dividing the source fused feature data and the target fused feature data into a plurality of feature data blocks in a local range;
[0027] Matching the source fused feature data with the feature data blocks corresponding to the target fused feature data to obtain a second index between the feature data blocks corresponding to the source fused feature data that best matches the feature data blocks corresponding to the target fused feature data;
[0028] The second feature data block corresponding to the stylized source image is reassembled using the second index to obtain the second stylized target feature data.
[0029] The present application also provides an interactive image texture migration and conversion device, comprising:
[0030] An image acquisition module, used to acquire a target semantic map, a stylized source image, and a source semantic map corresponding to the stylized source image;
[0031] A texture migration module, used for inputting the target semantic map, the stylized source image and the source semantic map into a deep neural network to obtain a target image, wherein the target image is obtained by performing texture migration conversion on the target semantic map with the stylized source image as a reference;
[0032] Among them, the deep neural network includes a plurality of texture migration layers connected in sequence, each of the texture migration layers includes an encoder, a texture migration unit and a decoder, and the output of the texture migration layer is used as one of the inputs of the next connected texture migration layer, until the output result of the texture migration layer of the last layer is used as the target image.
[0033] The present application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0034] Acquire a target semantic map, a stylized source image, and a source semantic map corresponding to the stylized source image;
[0035] Inputting the target semantic map, the stylized source image and the source semantic map into a deep neural network to obtain a target image, wherein the target image is obtained by performing texture migration conversion on the target semantic map with reference to the stylized source image;
[0036] Among them, the deep neural network includes a plurality of texture migration layers connected in sequence, each of the texture migration layers includes an encoder, a texture migration unit and a decoder, and the output of the texture migration layer is used as one of the inputs of the next connected texture migration layer, until the output result of the texture migration layer of the last layer is used as the target image.
[0037] The present application also provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0038] Acquire a target semantic map, a stylized source image, and a source semantic map corresponding to the stylized source image;
[0039] Inputting the target semantic map, the stylized source image and the source semantic map into a deep neural network to obtain a target image, wherein the target image is obtained by performing texture migration conversion on the target semantic map with reference to the stylized source image;
[0040] Among them, the deep neural network includes a plurality of texture migration layers connected in sequence, each of the texture migration layers includes an encoder, a texture migration unit and a decoder, and the output of the texture migration layer is used as one of the inputs of the next connected texture migration layer, until the output result of the texture migration layer of the last layer is used as the target image.
[0041] The above-mentioned interactive image texture migration conversion method, device, computer equipment and storage medium adopt a feedforward encoder-decoder network through the framework of the deep neural network in this application. The entire texture migration and image generation process only needs to feedforward through the network once, without any back propagation or other time-consuming operations, thus greatly improving the conversion speed. And the texture migration operation involved is independent of the type of input image and semantic map, and has good versatility. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A schematic diagram of a flow chart of an interactive image texture migration and conversion method in one embodiment;
[0043] Figure 2 A schematic diagram of a calculation process in a deep neural network in one embodiment;
[0044] Figure 3 A schematic flow chart of a global texture migration unit data processing step in one embodiment;
[0045] Figure 4 A schematic flow chart of data processing steps of a local texture migration unit in one embodiment;
[0046] Figure 5 A structural block diagram of an interactive image texture migration and conversion device in one embodiment;
[0047] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0049] In one embodiment, Figure 1 As shown, an interactive image texture migration conversion method is provided, comprising the following steps:
[0050] Step S100, obtaining a target semantic map, a stylized source image, and a source semantic map corresponding to the stylized source image;
[0051] Step S110, inputting the target semantic map, the stylized source image and the source semantic map into a deep neural network to obtain a target image, wherein the target image is obtained by texture migration conversion of the target semantic map with reference to the stylized source image;
[0052] Among them, the deep neural network includes multiple texture migration layers connected in sequence, each texture migration layer includes an encoder, a texture migration unit and a decoder, and the output of the texture migration layer is used as one of the inputs of the next connected texture migration layer, until the output result of the texture migration layer of the last layer is used as the target image.
[0053] In step S100, the target semantic map is a simple semantic map given by the user, and the user does not need to specify an image with specific content. The semantic map is different from the image. The semantic map is a semantic segmentation of the specific content image, that is, the image is recognized at the pixel level, that is, the object category to which each pixel in the image belongs is marked. It is more convenient for users to use only by giving a target semantic map. Users only need to edit the graffiti target semantic map according to their preferences to obtain the desired results, without finding or pre-processing other images or data as additional input. The stylized source image is a reference image for subsequent texture migration, and the source semantic map is obtained by semantic segmentation of the stylized source image.
[0054] In step S110, the deep neural network is an end-to-end, that is, a feedforward encoder-decoder network, so that the entire texture migration and image generation process only requires a feedforward traversal of the deep neural network once, without any back propagation or other time-consuming operations, which greatly improves the speed of texture migration.
[0055] In this embodiment, the deep neural network includes multiple layers of texture migration layers. Each layer maps the input data into feature data through an encoder, and then different texture migration units in each layer migrate the data in the feature dimension. Finally, the decoder decodes the data and remaps it back to the image, which then serves as the input data for the next layer. After traversing all the texture migration layers in sequence, the final output is the converted target image.
[0056] like Figure 2 As shown, a specific structure in a deep neural network is provided, as well as a target semantic map, a stylized source image, and a specific process of texture migration with the stylized source image in a deep neural network.
[0057] Specifically, the deep neural network includes five sequentially connected first to fifth texture migration layers, wherein the target semantic map, the stylized source image and the source semantic map are used as inputs of the first texture migration layer, and the target image is used as output of the fifth texture migration layer. The encoder includes first to fifth encoders sequentially located in each texture migration layer. The decoder includes first to fifth decoders sequentially located in each texture migration layer. The texture migration unit includes a global texture migration unit located in the first texture migration layer, a local texture migration unit located in the second texture migration layer, and a global texture enhancement unit located in the third to fifth texture migration layers.
[0058] Furthermore, if Figure 2 As shown, the first texture migration layer includes a first encoder, a global texture migration unit and a first decoder connected in sequence; the second texture migration layer includes a second encoder, a local texture migration unit and a second decoder connected in sequence; the third texture migration layer includes a third encoder, a global texture enhancement unit and a third decoder connected in sequence; the fourth texture migration layer includes a fourth encoder, a global texture enhancement unit and a fourth decoder connected in sequence; the fifth texture migration layer includes a fifth encoder, a global texture enhancement unit and a fifth decoder connected in sequence.
[0059] In this embodiment, the specific steps of inputting the target semantic map, the stylized source image, and the source semantic map into the deep neural network to obtain the stylized target image include:
[0060] In the first texture migration layer, the target semantic map, the stylized source image, and the source semantic map are input into a first encoder to obtain corresponding first feature data, a global texture migration unit performs a global texture migration calculation on the first feature data to obtain first stylized target feature data, and a first decoder is used to decode the first stylized target feature data into a first stylized target image;
[0061] In the second texture migration layer, the target semantic map, the stylized source image, the source semantic map, and the first stylized target image are input into a second encoder to obtain corresponding second feature data, a local texture migration unit performs texture migration calculation in a local range on the second feature data to obtain second stylized target feature data, and a second decoder is used to decode the second stylized target feature data into a second stylized target image;
[0062] In the third texture migration layer, the stylized source image and the second stylized target image are input into a third encoder to obtain corresponding third feature data, a global texture enhancement unit performs a global texture enhancement calculation on the third feature data to obtain third stylized target feature data, and a third decoder is used to decode the third stylized target feature data into a third stylized target image;
[0063] In the fourth texture migration layer, the stylized source image and the third stylized target image are input into a fourth encoder to obtain corresponding fourth feature data, a global texture enhancement unit performs a global texture enhancement calculation on the fourth feature data to obtain fourth stylized target feature data, and a fourth decoder is used to decode the fourth stylized target feature data into a fourth stylized target image;
[0064] In the fifth texture migration layer, the stylized source image and the fourth stylized target image are input into the fifth encoder to obtain corresponding fifth feature data, the fifth feature data is globally texture enhanced by the global texture enhancement unit to obtain fifth stylized target feature data, and the fifth decoder is used to decode the fifth stylized target feature data into a fifth stylized target image, and the fifth stylized target image is the target image.
[0065] In this embodiment, the encoders and decoders distributed in each layer are different and are located at different positions in the deep neural network.
[0066] In one embodiment, the first to fifth encoders use a deep neural network VGG19 pre-trained on a classification task based on the ImageNet dataset. Starting from the first layer of the deep neural network VGG19, the first encoder is to the Relu5_1 layer (the first activation layer of the fifth convolutional block), the second encoder is to the Relu4_1 layer, the third encoder is to the Relu3_1 layer, the fourth encoder is to the Relu2_1 layer, and the fifth encoder is to the Relu1_1 layer. The first to fifth encoders are used to map the image into the first to fifth feature data.
[0067] In one embodiment, the first to fifth decoders use an inverse network based on the deep neural network VGG19 pre-trained on the reconstruction task of the Microsoft COCO dataset. From the Relu5_1 layer to the first layer is the first decoder, from the Relu4_1 layer to the first layer is the second decoder, from the Relu3_1 layer to the first layer is the third decoder, from the Relu2_1 layer to the first layer is the fourth decoder, and from the Relu1_1 layer to the first layer is the fifth decoder. The first to fifth decoders are used to remap the first to fifth feature data back to the image.
[0068] like Figure 3 As shown, the specific steps of performing a global texture migration calculation on the first feature data by the global texture migration unit to obtain the first stylized target feature data include:
[0069] Step S300, dividing the first feature data into a plurality of first feature data blocks in a global scope;
[0070] Step S310, matching the target semantic graph with the plurality of first feature data blocks corresponding to the source semantic graph respectively, and obtaining a first index between the plurality of first feature data blocks corresponding to the source semantic graph that best matches the plurality of first feature data blocks corresponding to the target semantic graph;
[0071] Step S320: using the first index, reorganize the plurality of first feature data blocks corresponding to the stylized source image to obtain first stylized target feature data.
[0072] In step S300, globally means that when dividing the first feature data, a larger feature data block size is used.
[0073] In step S320, reorganization refers to replacing the corresponding first feature data block of the target semantic map with the first feature data block corresponding to the stylized source image using the first index, so that each block of the feature data of the target semantic map comes from the feature data of the stylized source image, and the feature data of the target semantic map after replacement is the stylized feature data, that is, the first stylized target feature data.
[0074] like Figure 4 As shown, the second stylized target feature data is obtained by performing texture migration calculation in a local range on the second feature data by the local texture migration unit, including:
[0075] Step S400, fusing the second feature data corresponding to the stylized source image and the source semantic map respectively to obtain source fused feature data;
[0076] Step S410, fusing the second feature data corresponding to the first stylized target image and the target semantic map respectively to obtain target fused feature data;
[0077] Step S420, dividing the second feature data corresponding to the stylized source image into a plurality of second feature data blocks in a local range, and dividing the source fused feature data and the target fused feature data into a plurality of feature data blocks in a local range;
[0078] Step S430, matching the source fused feature data with the feature data blocks corresponding to the target fused feature data, and obtaining a second index between the feature data blocks corresponding to the source fused feature data that best match the feature data blocks corresponding to the target fused feature data;
[0079] Step S440: using the second index, reorganize the second feature data block corresponding to the stylized source image to obtain second stylized target feature data.
[0080] In one embodiment, in steps S400 and S410, formula (1) and formula (2) are used for fusion:
[0081]
[0082]
[0083] In formula (1), F S represents the source fusion feature data, second feature data representing the stylized source image, The second feature data representing the source semantic graph.
[0084] In formula (2), F T represents the target fusion feature data, second feature data representing the first stylized target image, The second feature data representing the target semantic graph.
[0085] In formula (1) and formula (2), ω represents a hyperparameter for weighing the weight of semantic feature data, and ⊙ represents the concatenation operation on the channel dimension or the addition operation on the position dimension.
[0086] In step S420, the local range means that when dividing the second feature data and the feature data block, a smaller feature data block size is used.
[0087] In the second texture migration layer, the feature data are first fused in order to integrate the feature data of the source semantic map into the feature data of the stylized source image, and to integrate the feature data of the target semantic map into the feature data of the first stylized target image. This can provide more accurate semantic guidance when these fused feature data are subsequently matched and replaced, and the degree of semantic guidance can be controlled through parameters.
[0088] In one embodiment, in the third to fifth texture migration layers, the third to fifth feature data are globally enhanced by a global texture enhancement unit to obtain the third to fifth stylized target feature data in the same way, taking the third texture migration layer as an example.
[0089] First, the global statistical information of the third feature data of the stylized source image is calculated, where the global statistical information may be a mean and a standard deviation. Then, the third feature data of the second stylized target image is transformed so that its global statistical information (such as the mean and the standard deviation) is equal to the global statistical information of the third feature data of the stylized source image.
[0090] Furthermore, the third feature data of the second stylized target image is converted using formula (3):
[0091]
[0092] In formula (3), The third feature data representing the stylized source image, represents the third feature data of the second stylized target image, σ represents the operation of calculating the standard deviation, and μ represents the operation of calculating the mean.
[0093] In the third to fifth texture migration layers, the three texture enhancement calculations are performed at different network depths. For deeper networks, such as the third encoder, which is the first layer to the Relu3_1 layer of the deep neural network VGG19, texture enhancement tends to enhance high-level, abstract textures. For shallower networks, such as the fifth encoder, which is the first layer to the Relu1_1 layer of the deep neural network VGG19, texture enhancement tends to enhance low-level, fine textures. Therefore, texture enhancement in networks of different depths can take into account both enhancing high-level abstract textures and low-level fine textures, thereby obtaining higher quality texture migration results.
[0094] In the above-mentioned interactive image texture transfer conversion method, the target semantic map specified by the user interaction can refer to the given stylized source image and the corresponding source semantic map to generate a stylized target image after texture transfer, thereby realizing the migration and editing of the texture image by the user. In addition, due to its versatility and fast characteristics, users do not need to select specific machine learning models for different tasks, and the fast result response can greatly improve the user interaction experience.
[0095] In addition, compared with the traditional interactive texture transfer method based on machine learning, the use of deep neural network as the main architecture, with its good semantic and style information extraction and expression capabilities, can better capture the semantic structure information and style texture information of the stylized source image, thereby generating higher quality texture transfer results. And the user does not need to specify a specific content image, only needs the user to give a simple target semantic map to generate the texture transfer result. In addition, the intermediate feature data processing operations involved in this method do not require training based on big data, and compared with the neural network model based on deep learning big data training, this method does not rely on prior data knowledge, and therefore has better versatility and task independence.
[0096] It should be understood that although Figure 1-4 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-4At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0097] In one embodiment, Figure 5 As shown, an interactive image texture migration conversion device is provided, comprising: an image acquisition module 500 and a texture migration module 510, wherein:
[0098] An image acquisition module 500, configured to acquire a target semantic map, a stylized source image, and a source semantic map corresponding to the stylized source image;
[0099] A texture migration module 510 is used to input the target semantic map, the stylized source image and the source semantic map into a deep neural network to obtain a target image, wherein the target image is obtained by performing texture migration conversion on the target semantic map with the stylized source image as a reference;
[0100] Among them, the deep neural network includes a plurality of texture migration layers connected in sequence, each of the texture migration layers includes an encoder, a texture migration unit and a decoder, and the output of the texture migration layer is used as one of the inputs of the next connected texture migration layer, until the output result of the texture migration layer of the last layer is used as the target image.
[0101] The specific definition of the interactive image texture migration conversion device can be found in the definition of the interactive image texture migration conversion method above, which will not be repeated here. Each module in the above-mentioned interactive image texture migration conversion device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0102] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 6As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an interactive image texture migration and conversion method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a key, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse, etc.
[0103] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0104] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0105] Acquire a target semantic map, a stylized source image, and a source semantic map corresponding to the stylized source image;
[0106] Inputting the target semantic map, the stylized source image and the source semantic map into a deep neural network to obtain a target image, wherein the target image is obtained by performing texture migration conversion on the target semantic map with reference to the stylized source image;
[0107] Among them, the deep neural network includes a plurality of texture migration layers connected in sequence, each of the texture migration layers includes an encoder, a texture migration unit and a decoder, and the output of the texture migration layer is used as one of the inputs of the next connected texture migration layer, until the output result of the texture migration layer of the last layer is used as the target image.
[0108] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0109] The deep neural network includes five sequentially connected first to fifth texture migration layers, wherein the target semantic map, the stylized source image and the source semantic map serve as inputs of the first texture migration layer, and the target image serves as output of the fifth texture migration layer;
[0110] The encoder includes first to fifth encoders sequentially located at each texture migration layer;
[0111] The decoder comprises first to fifth decoders sequentially located at each texture migration layer;
[0112] The texture migration unit includes a global texture migration unit located in the first texture migration layer, a local texture migration unit located in the second texture migration layer, and a global texture enhancement unit located in the third to fifth texture migration layers.
[0113] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0114] Acquire a target semantic map, a stylized source image, and a source semantic map corresponding to the stylized source image;
[0115] Inputting the target semantic map, the stylized source image and the source semantic map into a deep neural network to obtain a target image, wherein the target image is obtained by performing texture migration conversion on the target semantic map with reference to the stylized source image;
[0116] Among them, the deep neural network includes a plurality of texture migration layers connected in sequence, each of the texture migration layers includes an encoder, a texture migration unit and a decoder, and the output of the texture migration layer is used as one of the inputs of the next connected texture migration layer, until the output result of the texture migration layer of the last layer is used as the target image.
[0117] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0118] The deep neural network includes five sequentially connected first to fifth texture migration layers, wherein the target semantic map, the stylized source image and the source semantic map serve as inputs of the first texture migration layer, and the target image serves as output of the fifth texture migration layer;
[0119] The encoder includes first to fifth encoders sequentially located at each texture migration layer;
[0120] The decoder comprises first to fifth decoders sequentially located at each texture migration layer;
[0121] The texture migration unit includes a global texture migration unit located in the first texture migration layer, a local texture migration unit located in the second texture migration layer, and a global texture enhancement unit located in the third to fifth texture migration layers.
[0122] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0123] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0124] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. An interactive image texture migration conversion method, characterized in that: include: Acquire a target semantic map, a stylized source image, and a source semantic map corresponding to the stylized source image; Inputting the target semantic map, the stylized source image and the source semantic map into a deep neural network to obtain a target image, wherein the target image is obtained by performing texture migration conversion on the target semantic map with reference to the stylized source image; The deep neural network includes five sequentially connected first to fifth texture migration layers, wherein the target semantic map, the stylized source image and the source semantic map serve as inputs of the first texture migration layer, and the target image serves as output of the fifth texture migration layer; The encoder includes first to fifth encoders sequentially located at each texture migration layer; The decoder includes first to fifth decoders sequentially located at each texture migration layer; The texture migration unit includes a global texture migration unit located in the first texture migration layer, a local texture migration unit located in the second texture migration layer, and a global texture enhancement unit located in the third to fifth texture migration layers; Inputting the target semantic map, the stylized source image, and the source semantic map into a deep neural network to obtain a stylized target image includes: Inputting the target semantic map, the stylized source image, and the source semantic map into a first encoder to obtain corresponding first feature data, performing a global texture migration calculation on the first feature data by the global texture migration unit to obtain first stylized target feature data, and decoding the first stylized target feature data into a first stylized target image by a first decoder; Inputting the target semantic map, the stylized source image, the source semantic map, and the first stylized target image into a second encoder to obtain corresponding second feature data, performing texture migration calculation in a local range on the second feature data by the local texture migration unit to obtain second stylized target feature data, and decoding the second stylized target feature data into a second stylized target image by a second decoder; Inputting the stylized source image and the second stylized target image into a third encoder to obtain corresponding third feature data, performing a global texture enhancement calculation on the third feature data by the global texture enhancement unit to obtain third stylized target feature data, and decoding the third stylized target feature data into a third stylized target image by a third decoder; Inputting the stylized source image and the third stylized target image into a fourth encoder to obtain corresponding fourth feature data, performing a global texture enhancement calculation on the fourth feature data by the global texture enhancement unit to obtain fourth stylized target feature data, and decoding the fourth stylized target feature data into a fourth stylized target image by a fourth decoder; The stylized source image and the fourth stylized target image are input into a fifth encoder to obtain corresponding fifth feature data, the global texture enhancement unit performs a global texture enhancement calculation on the fifth feature data to obtain fifth stylized target feature data, and the fifth decoder is used to decode the fifth stylized target feature data into a fifth stylized target image, and the fifth stylized target image is the target image.
2. The interactive image texture migration conversion method according to claim 1, characterized in that: The step of performing a global texture migration calculation on the first feature data by the global texture migration unit to obtain the first stylized target feature data includes: Dividing the first feature data into a plurality of first feature data blocks globally; Matching the target semantic graph and the plurality of first feature data blocks corresponding to the source semantic graph respectively, to obtain a first index between the plurality of first feature data blocks corresponding to the source semantic graph that best matches the plurality of first feature data blocks corresponding to the target semantic graph; The first index is used to reorganize a plurality of first feature data blocks corresponding to the stylized source image to obtain the first stylized target feature data.
3. The interactive image texture migration conversion method according to claim 1, characterized in that: The step of performing texture migration calculation in a local range on the second feature data by the local texture migration unit to obtain the second stylized target feature data comprises: Fusing the second feature data corresponding to the stylized source image and the source semantic map respectively to obtain source fused feature data; Fusing the first stylized target image and the second feature data corresponding to the target semantic map respectively to obtain target fused feature data; Dividing the second feature data corresponding to the stylized source image into a plurality of second feature data blocks in a local range, and dividing the source fused feature data and the target fused feature data into a plurality of feature data blocks in a local range; Matching the source fused feature data with the feature data blocks corresponding to the target fused feature data to obtain a second index between the feature data blocks corresponding to the source fused feature data that best matches the feature data blocks corresponding to the target fused feature data; The second feature data block corresponding to the stylized source image is reassembled using the second index to obtain the second stylized target feature data.
4. An interactive image texture migration and conversion device, characterized in that: include: An image acquisition module, used to acquire a target semantic map, a stylized source image, and a source semantic map corresponding to the stylized source image; A texture migration module, used for inputting the target semantic map, the stylized source image and the source semantic map into a deep neural network to obtain a target image, wherein the target image is obtained by performing texture migration conversion on the target semantic map with the stylized source image as a reference; The deep neural network includes five sequentially connected first to fifth texture migration layers, wherein the target semantic map, the stylized source image and the source semantic map serve as inputs of the first texture migration layer, and the target image serves as output of the fifth texture migration layer; The encoder includes first to fifth encoders sequentially located at each texture migration layer; The decoder includes first to fifth decoders sequentially located at each texture migration layer; The texture migration unit includes a global texture migration unit located in the first texture migration layer, a local texture migration unit located in the second texture migration layer, and a global texture enhancement unit located in the third to fifth texture migration layers; Inputting the target semantic map, the stylized source image, and the source semantic map into a deep neural network to obtain a stylized target image includes: Inputting the target semantic map, the stylized source image, and the source semantic map into a first encoder to obtain corresponding first feature data, performing a global texture migration calculation on the first feature data by the global texture migration unit to obtain first stylized target feature data, and decoding the first stylized target feature data into a first stylized target image by a first decoder; Inputting the target semantic map, the stylized source image, the source semantic map, and the first stylized target image into a second encoder to obtain corresponding second feature data, performing texture migration calculation in a local range on the second feature data by the local texture migration unit to obtain second stylized target feature data, and decoding the second stylized target feature data into a second stylized target image by a second decoder; Inputting the stylized source image and the second stylized target image into a third encoder to obtain corresponding third feature data, performing a global texture enhancement calculation on the third feature data by the global texture enhancement unit to obtain third stylized target feature data, and decoding the third stylized target feature data into a third stylized target image by a third decoder; Inputting the stylized source image and the third stylized target image into a fourth encoder to obtain corresponding fourth feature data, performing a global texture enhancement calculation on the fourth feature data by the global texture enhancement unit to obtain fourth stylized target feature data, and decoding the fourth stylized target feature data into a fourth stylized target image by a fourth decoder; The stylized source image and the fourth stylized target image are input into a fifth encoder to obtain corresponding fifth feature data, the global texture enhancement unit performs a global texture enhancement calculation on the fifth feature data to obtain fifth stylized target feature data, and the fifth decoder is used to decode the fifth stylized target feature data into a fifth stylized target image, and the fifth stylized target image is the target image.
5. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the interactive image texture migration and conversion method according to any one of claims 1 to 3 are implemented.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the interactive image texture migration and conversion method according to any one of claims 1 to 3 are implemented.
