Text-based image generation method, device, equipment and storage medium
Through deep coding and text feature enhancement processing, combined with an improved cyclic variational autoencoder and a multi-scale dynamic convolutional neural network, the problem of flexibility and accuracy of the image generation model in processing user needs is solved, and personalized images are realized. Generate, and improve the generalization ability and efficiency of the model while ensuring the privacy of user data.
Patent Information
- Application Number
- CN202410914072.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-09
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-07-09
AI Technical Summary
Existing image generation models lack flexibility and accuracy when dealing with specific user needs, and it is difficult to effectively utilize dispersed user data for model training while ensuring user data privacy.
By receiving and parsing image generation requests from multiple user nodes, depth encoding and text feature enhancement processing are performed, and improved cyclic variational autoencoders and multi-scale dynamic convolutional neural networks are used for image generation network training, combining attention mechanisms and The genetic algorithm performs parameter optimization, realizes distributed training and model updating, and only uploads model parameters instead of original data.
It significantly improves the personalization and accuracy of image generation, protects user data privacy, makes full use of dispersed data to improve model generalization capabilities, reduces the computing and storage pressure on the central server, and improves the efficiency and accuracy of model updates.
Smart Images

Figure CN118468943B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image generation technology, and in particular to a text-based image generation method, device, equipment and storage medium. Background Art
[0002] With the rapid development of deep learning technology, image generation models have become one of the hot topics of research. These models can generate high-quality and diverse image content by learning a large amount of image data, and are applied to many fields such as art creation, game design, and virtual reality. Especially in the fields of computer vision and natural language processing, how to generate corresponding images based on text descriptions has become a challenging topic. This requires not only that the model can understand the complex semantic information in the text, but also that it can accurately convert this information into visual content.
[0003] However, in practical applications, a key issue is how to efficiently process and meet personalized image generation requests from different users. Traditional image generation models are usually trained on a unified dataset, which may lead to a lack of flexibility and accuracy in the model when processing specific user needs. In addition, as the amount of user data increases, how to effectively use these scattered data resources for model training while protecting user data privacy has also become an urgent problem to be solved. Summary of the invention
[0004] The present application provides a text-based image generation method, apparatus, device and storage medium, which are used to improve the efficiency of text-based image generation.
[0005] In a first aspect, the present application provides a text-based image generation method, the text-based image generation method comprising:
[0006] Receiving image generation requests of multiple user nodes and parsing to obtain initial text data of each user node, and deeply encoding the initial text data of each user node to obtain encoded text data of each user node;
[0007] Perform text feature enhancement processing on the encoded text data of each user node to obtain a text feature vector of each user node;
[0008] Distribute the improved cyclic variational autoencoder and the multi-scale dynamic convolutional neural network to each user node through the central node and perform image generation network training through the text feature vector to obtain the target output image of each user node;
[0009] Constructing an initial network parameter combination of each user node according to the target output image, and performing global parameter analysis on the initial network parameter combination to obtain a target network parameter combination;
[0010] The target network parameter combination is distributed to the multiple user nodes through the central node to perform network parameter update and iterative optimization to generate a target image generation model.
[0011] In a second aspect, the present application provides a text-based image generation device, the text-based image generation device comprising:
[0012] A receiving module, used to receive image generation requests from multiple user nodes and parse to obtain initial text data of each user node, and perform deep encoding on the initial text data of each user node to obtain encoded text data of each user node;
[0013] A processing module, used for performing text feature enhancement processing on the encoded text data of each user node to obtain a text feature vector of each user node;
[0014] A training module, used for distributing the improved cyclic variational autoencoder and the multi-scale dynamic convolutional neural network to each user node through a central node and performing image generation network training through the text feature vector to obtain a target output image for each user node;
[0015] An analysis module, used to construct an initial network parameter combination of each user node according to the target output image, and perform global parameter analysis on the initial network parameter combination to obtain a target network parameter combination;
[0016] The optimization module is used to distribute the target network parameter combination to the multiple user nodes through the central node to perform network parameter update and iterative optimization to generate a target image generation model.
[0017] The third aspect of the present application provides a text-based image generation device, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the text-based image generation device executes the above-mentioned text-based image generation method.
[0018] A fourth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned text-based image generation method.
[0019] In the technical solution provided by the present application, by receiving and parsing the image generation requests of multiple user nodes, the model can perform deep encoding according to the initial text data provided by the user, and then generate images that are highly matched with the user's needs. It can understand and convert complex text descriptions to provide users with more personalized and accurate image generation services. By performing text feature enhancement processing on the encoded text data, the model not only captures the local features of the text data, but also extracts deep semantic information through the dynamic semantic memory network, significantly improving the model's understanding depth and accuracy of the text content. This is particularly important for understanding complex, ambiguous or ambiguous text descriptions, which helps to generate richer and more delicate image content. The improved cyclic variational autoencoder and multi-scale dynamic convolutional neural network are used to train the image generation network in combination with the text feature vector, which not only improves the image generation quality, but also optimizes the training process through advanced technologies such as attention mechanisms. It can more effectively capture and utilize the association between text and image to generate more realistic and attractive images. Through the coordination of the central node, each user node completes model training and parameter update locally, and only model parameters rather than original data are uploaded and shared, effectively protecting the privacy of user data. This distributed training mechanism can also make full use of data from different users, improve the generalization ability of the model, and reduce the computing and storage pressure of the central server. Through global parameter analysis and the generation of target network parameter combinations, the model can be optimized according to the performance indicators fed back by all user nodes, ensuring the efficiency and accuracy of model updates. In addition, the use of optimization algorithms such as genetic algorithms further improves the scientific nature of parameter selection and model performance, so this application improves the efficiency of text-based image generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0021] Figure 1 A schematic diagram of an embodiment of a text-based image generation method in an embodiment of the present application;
[0022] Figure 2 Schematic diagram of an embodiment of a text-based image generation device in an embodiment of the present application. DETAILED DESCRIPTION
[0023] The embodiments of the present application provide a text-based image generation method, device, equipment and storage medium. The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described here can be implemented in an order other than that illustrated or described here. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0024] For ease of understanding, the specific process of the embodiment of the present application is described below. Figure 1 , an embodiment of the text-based image generation method in the embodiment of the present application includes:
[0025] Step S101, receiving image generation requests of multiple user nodes and parsing to obtain initial text data of each user node, and performing deep encoding on the initial text data of each user node to obtain encoded text data of each user node;
[0026] It is understandable that the execution subject of the present application may be a text-based image generation device, or a terminal or a server, which is not limited here. The present application embodiment is described by taking a server as the execution subject as an example.
[0027] Specifically, image generation requests from multiple user nodes are received. These requests contain initial text data that users want to generate images for. After receiving the request, the request is parsed to extract the initial text data of each user node. The initial text data provided by each user node is preprocessed. Text preprocessing includes cleaning data, removing stop words, correcting spelling errors, etc., with the purpose of converting the initial text data into standard text data for subsequent processing. Text entity words are extracted from the standard text data of each user node. By identifying key entity words (such as nouns, proper nouns, etc.) in the text and forming them into a text entity word set, the main meaning and content of the text are captured. The extraction of entity words can help the model better understand the user's image generation needs, thereby generating images that better meet the user's expectations. The text entity word set of each user node is embedded vector encoded. By converting the text entity words into a vector form, namely an embedding vector, the text data can be processed by the computer and the model. The text local feature extraction is performed on the text encoding vector of each user node through a deep convolutional network. The deep convolutional network can identify local patterns and features in text data and generate a local feature vector for each user node. The local feature vector of each user node is processed by the cyclic text encoder to capture the sequence dependency and generate the encoded text data of each user node. The cyclic text encoder is suitable for processing text data with sequence dependency and can capture the time series information and long-distance dependency in the text.
[0028] Step S102: Perform text feature enhancement processing on the encoded text data of each user node to obtain a text feature vector of each user node;
[0029] Specifically, the encoded text data of each user node is input into the dynamic semantic memory network. The network can interact effectively with a pre-trained image-generated text database. Through this interaction, the network can generate specific deep semantic information for each user node based on the rich information in the database. The memory state of each user node is generated based on the deep semantic information, and the deep semantic information is converted into an internal representation, which can be further processed by the network. The dynamic semantic memory network processes these memory states through a first fully connected layer of a tanh function. This process is called text feature enhancement. The tanh function is widely used in neural networks because it can compress input values to a range of -1 to 1. This compression helps to enhance key information in the memory state while suppressing unimportant information, thereby generating the first feature vector of each user node. The first feature vector is input into the second fully connected layer in the dynamic semantic memory network. The feature vector is converted through the Softmax function to convert the first feature vector into a text feature vector. The Softmax function is suitable for processing this conversion and can normalize multiple input values into a probability distribution, that is, the value of each element is between 0 and 1, and the sum of all element values is 1. Normalization ensures that each feature vector reflects the uniqueness and specific needs of the user node.
[0030] Step S103, distributing the improved cyclic variational autoencoder and the multi-scale dynamic convolutional neural network to each user node through the central node and performing image generation network training through the text feature vector to obtain the target output image of each user node;
[0031] Specifically, the improved recurrent variational autoencoder and multi-scale dynamic convolutional neural network are distributed to each user node through the central node. The model includes several key components, such as the first encoding RNN layer, the second encoding RNN layer, the attention mechanism layer, and the decoding RNN layer. The text feature vector of each user node is input into the improved model. The encoding feature of the text feature vector is extracted through the first encoding RNN layer, and the sequence information in the text is captured by the ability of the recurrent neural network to generate the first encoding vector of each user node. The second encoding RNN layer further processes these text feature vectors to extract deeper encoding features and obtain the second encoding vector of each user node. The first and second encoding vectors are weightedly fused by the attention mechanism layer of the model. The attention mechanism ensures that the model can focus on the most important information in the text feature vector by assigning different weights to different parts of the encoding vector, and obtains the attention weighted vector of each user node. The decoding RNN layer decodes the attention weighted vector of each user node by hidden variables and converts the weighted vector into hidden variable data, which contains all the key information required to generate the image. As the internal representation of the model, the hidden variable is a bridge connecting text information and image generation. The latent variable data is converted into the target output image through a multi-scale dynamic convolutional neural network. The multi-scale dynamic convolutional neural network can process features of different scales and dynamically adjust the convolution kernel size to adapt to different image generation requirements.
[0032] Step S104: constructing an initial network parameter combination for each user node according to the target output image, and performing a global parameter analysis on the initial network parameter combination to obtain a target network parameter combination;
[0033] Specifically, the matching degree of the target output image and the initial text data is analyzed, the degree of conformity between the generated image and the original text description is evaluated, and the matching degree index of each target output image is calculated. The genetic algorithm is used to construct the initial network parameter combination for each user node according to the matching degree index. The genetic algorithm can effectively search for the optimal solution in the parameter space by simulating the principles of natural selection and genetics. The initial network parameter combination of each user node includes the initial weights and bias parameters of the multi-layer network, which are the basis for the network to successfully perform tasks. The genetic algorithm selects the combination with the highest matching degree as the initial network parameter by evaluating the performance of different parameter combinations, which ensures that the image generation model of each user node is trained from a set of relatively optimized parameters. The initial network parameter combinations of all user nodes are sent to the central node. The central node plays the role of parameter optimization and coordination, and further optimizes the parameters by performing weighted average operations on the initial weights and bias parameters of each layer of the network in all the collected initial network parameter combinations. By summarizing the information and feedback of all user nodes, it is ensured that the target weights and bias parameters of each layer of the network finally determined can reflect the global optimum. According to the target weight and bias parameters of each layer of the network, the corresponding target network parameter combination is generated.
[0034] Among them, the optimization objective function of each user node is defined according to the matching index, and the initial network parameter combination of each user node is constructed by a genetic algorithm. The genetic algorithm solves the optimization problem by simulating operations such as crossover, mutation, and selection in the biological evolution process. The objective function quantifies the degree of match between the network parameters and the expected output, that is, the consistency between the generated image and the user's initial text description. By optimizing the objective function, the genetic algorithm initializes the network parameter population, generates multiple first network parameter combinations, and randomly generates a set of network parameters for each user node, including the initial weights and bias parameters of the multilayer network. These first network parameter combinations constitute the initial population in the search space. The algorithm calculates the fitness value of each first network parameter combination by optimizing the objective function. The fitness value reflects the effectiveness of each set of parameters in solving the image generation task, that is, how the parameter combination affects the matching degree between the generated image and the user's text description. Based on the fitness value, the algorithm divides all the first network parameter combinations into groups to form multiple network parameter combination groups. According to the network parameter combination group, the algorithm generates corresponding multiple second network parameter combinations, including crossover and mutation operations, simulating the recombination and random mutation of genes in biological inheritance. The crossover operation allows parameter combinations from different parents to exchange information, while the mutation operation introduces new mutations to increase the diversity of the population. Through these operations, the algorithm explores new parameter spaces and searches for better network parameter combinations. Finally, by optimizing multiple second network parameter combinations, the initial network parameter combination for each user node is obtained.
[0035] Step S105: distribute the target network parameter combination to multiple user nodes through the central node to perform network parameter update and iterative optimization to generate a target image generation model.
[0036] Specifically, the target network parameter combination is distributed to multiple user nodes through the central node to ensure that each node can perform local training based on the latest global parameters, thereby improving the performance and efficiency of the overall model. Each user node calculates the update amount of the network parameters based on its own data. The calculation of the update amount is completed according to the network parameter update amount calculation function, which takes into account the loss function gradient and regularization term of each node to ensure that the update can both reduce the loss and prevent overfitting. By applying the update amount to each user node, the image generation model of each node is initially adjusted. This process includes fine-tuning the parameters of the improved cyclic variational autoencoder and the multi-scale dynamic convolutional neural network to generate an initial image generation model for each user node. The learning rate of each initial image generation model is dynamically adjusted and the feedback of the model performance is weighted. Based on the performance evaluation index of each model, the training process of the model is optimized by adjusting the learning rate, and the model is weighted by performance feedback to ensure that the direction of model training is correct and efficient. The performance evaluation index provides a quantitative basis for the optimization of the model. According to the model performance evaluation index, each initial image generation model is iteratively optimized and globally updated. The model is trained for multiple iterations, and each iteration is adjusted based on performance feedback to ensure that the model can continue to improve and eventually reach or exceed the predetermined performance goals. The global update is to aggregate the training results of all user nodes and update the global model parameters to ensure the overall optimization and improvement of the model. Finally, a target image generation model is generated, which can not only efficiently generate high-quality images based on the user's text description, but also has high generalization ability and stability.
[0037] In the embodiment of the present application, by receiving and parsing the image generation request of multiple user nodes, the model can perform deep encoding according to the initial text data provided by the user, and then generate an image that is highly matched with the user's needs. It can understand and convert complex text descriptions to provide users with more personalized and accurate image generation services. By performing text feature enhancement processing on the encoded text data, the model not only captures the local features of the text data, but also extracts deep semantic information through the dynamic semantic memory network, significantly improving the model's understanding depth and accuracy of the text content. This is particularly important for understanding complex, ambiguous or ambiguous text descriptions, and helps to generate richer and more delicate image content. Using an improved cyclic variational autoencoder and a multi-scale dynamic convolutional neural network, combined with text feature vectors for image generation network training, not only improves the image generation quality, but also optimizes the training process through advanced technologies such as attention mechanisms. It can more effectively capture and utilize the association between text and image to generate more realistic and attractive images. Through the coordination of the central node, each user node completes model training and parameter updates locally, and only model parameters rather than original data are uploaded and shared, effectively protecting the privacy of user data. This distributed training mechanism can also make full use of data from different users, improve the generalization ability of the model, and reduce the computing and storage pressure of the central server. Through global parameter analysis and the generation of target network parameter combinations, the model can be optimized according to the performance indicators fed back by all user nodes, ensuring the efficiency and accuracy of model updates. In addition, the use of optimization algorithms such as genetic algorithms further improves the scientific nature of parameter selection and model performance, so this application improves the efficiency of text-based image generation.
[0038] In a specific embodiment, the process of executing step S101 may specifically include the following steps:
[0039] (1) receiving image generation requests from multiple user nodes, parsing the image generation requests, and obtaining initial text data of each user node;
[0040] (2) Performing text preprocessing on the initial text data of each user node to obtain standard text data of each user node;
[0041] (3) Extract text entity words from the standard text data of each user node to obtain a text entity word set for each user node;
[0042] (4) Perform embedding vector encoding on the text entity word set of each user node to obtain the text encoding vector of each user node;
[0043] (5) Using a deep convolutional network, the text encoding vector of each user node is extracted for local text features to obtain a local feature vector for each user node;
[0044] (6) The local feature vector of each user node is captured in sequence dependency through a cyclic text encoder to generate encoded text data for each user node.
[0045] Specifically, image generation requests from multiple user nodes are received through a network interface. These requests usually contain preliminary information about the images that users want to generate through text descriptions. The image generation requests are parsed to extract the initial text data in each request. The initial text data provided by each user node is preprocessed. The preprocessing steps include standardizing the text, such as converting it to lowercase, removing punctuation and stop words, and correcting spelling errors. Text entity words are extracted from the standardized text data. The system identifies and extracts key entity words, such as nouns or proper nouns, to form a text entity word set. The text entity word set of each user node is embedded vector encoded to convert the text into a format that can be processed by a machine learning model. The embedding process is achieved by mapping each word in the text to a vector in a high-dimensional space, and these vectors can capture the semantic relationship between words. A deep convolutional network is used to extract local features from the text encoding vector of each user node. The deep convolutional network can identify and extract local features that are helpful for generating images by learning patterns in the text data. The extracted local feature vector is processed by a cyclic text encoder to generate encoded text data for each user node. Recurrent text encoders are suitable for processing sequential data and can capture long-term dependencies in text, such as the order in which an event occurs or the logical relationship in a description.
[0046] In a specific embodiment, the process of executing step S102 may specifically include the following steps:
[0047] (1) Input the encoded text data of each user node into the dynamic semantic memory network respectively;
[0048] (2) Generate deep semantic information for each user node by interacting with the pre-trained image-generated text database through a dynamic semantic memory network;
[0049] (3) Generate the memory state of each user node based on deep semantic information;
[0050] (4) Through the tanh function of the first fully connected layer in the dynamic semantic memory network, the memory state of each user node is enhanced with text features, and the first feature vector of each user node is output;
[0051] (5) The first feature vector of each user node is transformed into a feature vector through the Softmax function of the second fully connected layer in the dynamic semantic memory network to obtain the text feature vector of each user node.
[0052] Specifically, the encoded text data provided by each user node is input into the dynamic semantic memory network. The network is an intelligent processing unit that can dynamically adjust its behavior according to the characteristics of the input data. The dynamic semantic memory network can interact deeply with a pre-trained image generation text database. The database contains a large number of text-to-image mapping relationships, providing a rich knowledge base for the network to help the network understand the meaning behind various text descriptions. Through interaction with the pre-trained database, the dynamic semantic memory network can generate deep semantic information for each user node. The deep semantic information provides a more accurate understanding of the user's text description, making the generated image closer to the user's original intention. Based on the deep semantic information, the network further generates a memory state for each user node. The memory state is an internal representation of the deep semantic information, which captures the most important features and attributes in the text description. In order to enhance the text features and better serve image generation, the dynamic semantic memory network uses the tanh function of its first fully connected layer to process the memory state of each user node. As an activation function, the tanh function can compress the input data into the range of -1 to 1. The nonlinear transformation helps to highlight important features and suppress irrelevant information, thereby generating a first feature vector with enhanced features. The network transforms the first feature vector through the Softmax function of the second fully connected layer to obtain the final text feature vector. As another activation function, the Softmax function can transform the input vector into a probability distribution, in which the value of each element represents the importance of the feature in image generation. This transformation ensures that the final text feature vector not only contains all the necessary information, but is also sorted and weighted according to its importance.
[0053] In a specific embodiment, the process of executing step S103 may specifically include the following steps:
[0054] (1) Distribute the improved cyclic variational autoencoder and multi-scale dynamic convolutional neural network to each user node through the central node;
[0055] (2) The text feature vector of each user node is input into an improved recurrent variational autoencoder and a multi-scale dynamic convolutional neural network. The improved recurrent variational autoencoder includes a first encoding RNN layer, a second encoding RNN layer, an attention mechanism layer, and a decoding RNN layer;
[0056] (3) Extracting encoding features from the text feature vector of each user node through the first encoding RNN layer to obtain the first encoding vector of each user node;
[0057] (4) extracting encoding features from the text feature vector of each user node through the second encoding RNN layer to obtain a second encoding vector for each user node;
[0058] (5) Performing attention-weighted fusion on the first encoding vector and the second encoding vector through the attention mechanism layer to obtain the attention weighted vector of each user node;
[0059] (6) The attention weighted vector of each user node is decoded by the decoding RNN layer to obtain the hidden variable data of each user node;
[0060] (7) The latent variable data of each user node is image generated through a multi-scale dynamic convolutional neural network to obtain the target output image of each user node.
[0061] Specifically, the improved cyclic variational autoencoder and multi-scale dynamic convolutional neural network are distributed to each user node through the central node. It is ensured that all user nodes can access the latest model architecture and algorithm, providing a unified technical foundation for subsequent image generation. The design of the model takes into account various needs in the text-to-image conversion process, including the need for a deep understanding of text data and the need for different scales of processing details when generating images. The text feature vector of each user node is input into the improved cyclic variational autoencoder and multi-scale dynamic convolutional neural network. The encoder includes a first encoding RNN layer, a second encoding RNN layer, an attention mechanism layer, and a decoding RNN layer. The first encoding RNN layer performs preliminary encoding feature extraction on the input text feature vector to obtain the first encoding vector of each user node. This layer captures the sequence dependency and time characteristics in the text data through the structure of the recurrent neural network, thereby extracting the basic semantic structure of the text description. The second encoding RNN layer further analyzes these preliminary encoded features in depth to obtain the second encoding vector of each user node, extracting more complex and deeper semantic information based on the first layer. The first encoding vector and the second encoding vector are weighted fused through the attention mechanism layer. By weighted fusion of different encoding vectors, we can focus on the information that is most critical to generating the target image, thereby obtaining the attention weighted vector for each user node. The attention weighted vector is decoded by the decoding RNN layer to obtain the hidden variable data of each user node. The extracted and weighted text features are converted into internal representations that can be directly used for image generation. The hidden variable data contains all the key information required to generate the image. The hidden variable data of each user node is processed by a multi-scale dynamic convolutional neural network to generate the target output image. The network can dynamically adjust its behavior at different scales based on the information in the hidden variable data, thereby generating images with rich details and highly matching the user description.
[0062] In a specific embodiment, the process of executing step S104 may specifically include the following steps:
[0063] (1) Analyze the matching degree between the target output image and the initial text data to obtain the matching degree index of each target output image;
[0064] (2) Using a genetic algorithm to construct the initial network parameter combination for each user node based on the matching index, the initial network parameter combination includes the initial weights and bias parameters of the multi-layer network;
[0065] (3) The initial network parameter combination of each user node is sent to the central node, and the central node performs a weighted average operation on the initial weight and bias parameters of each layer of the network in the initial network parameter combination to obtain the target weight and bias parameters of each layer of the network;
[0066] (4) Generate the corresponding target network parameter combination based on the target weight and bias parameters of each layer of the network.
[0067] Specifically, a matching degree analysis is performed on each target output image and the corresponding initial text data. Natural language processing and image recognition technology are used to compare the correlation between the image content and the text description, and a matching degree index is generated for each target output image, which reflects the degree of matching between the image and the text description. The initial network parameter combination is constructed for each user node based on the matching degree index through a genetic algorithm. A genetic algorithm is an optimization algorithm that imitates the natural selection and genetic mechanism in biological evolution, in which each network parameter combination is regarded as an "individual" and its "gene" is the weight and bias parameters of the network. The initial network parameter combination is obtained by random generation or adjustment based on a pre-trained model, and then evaluated based on the matching degree index of the image they generate. The parameter combination with the highest "fitness" - that is, the parameter combination that generates the image with the highest matching degree with the text description - has a higher probability of being selected and generating a new parameter combination through crossover and mutation operations. This process simulates natural selection and aims to optimize network parameters from generation to generation to improve the accuracy and quality of image generation. The initial network parameter combination of each user node is sent to the central node. The central node collects the optimized network parameters on all user nodes and performs weighted average calculation on these parameters to obtain the target weights and bias parameters of each layer of the network. These parameters reflect the comprehensive experience of all user nodes and aim to improve the generalization ability of the model. Based on the optimized and summarized target weights and bias parameters, the corresponding target network parameter combination is generated. The target network parameter combination is applied to the image generation model, which enables the model to not only generate images more accurately based on the user's text description, but also continuously learn and evolve from user feedback to improve its performance.
[0068] In a specific embodiment, the process of executing step S105 may specifically include the following steps:
[0069] (1) Defining the optimization objective function of each user node according to the matching index, and initializing the network parameter population through a genetic algorithm to obtain multiple first network parameter combinations;
[0070] (2) calculating the fitness value of each first network parameter combination by optimizing the objective function, and dividing the multiple first network parameter combinations into groups according to the fitness values to obtain multiple network parameter combination groups;
[0071] (3) Generate corresponding multiple second network parameter combinations based on the multiple network parameter combination groups, and optimize the multiple second network parameter combinations to obtain an initial network parameter combination for each user node, where the initial network parameter combination includes initial weights and bias parameters of the multi-layer network.
[0072] Specifically, an optimization objective function is defined for each user node based on the matching index between each target output image and the initial text data. This function aims to quantify how the network parameters affect the ability to generate images that match the text description, thereby providing a clear optimization target for the genetic algorithm. The matching index itself is calculated by analyzing whether the image content accurately reflects the key information of the text description, for example, whether the objects, actions and scenes in the image match the text description. The optimization objective function therefore includes not only the quantification of the matching degree, but may also include other regularization terms to avoid overfitting and maintain the generalization ability of the network. The network parameter population is initialized by the genetic algorithm to generate multiple first network parameter combinations. In this process, each parameter combination is regarded as an "individual" in the population, and its "gene" is the weight and bias parameters of the network. These parameter combinations are randomly generated and are intended to cover the possible parameter space, providing a diverse starting point for subsequent iterations of the genetic algorithm. The initialization phase is the basis of the entire genetic algorithm process, which ensures that the algorithm has enough diversity to explore the solution space and find the optimal solution. The fitness value is calculated for each first network parameter combination by optimizing the objective function. The fitness value is a measure of the contribution of each parameter combination to the optimization goal, that is, the degree of match between the generated image and the text description. Based on the fitness value, the system divides all the first network parameter combinations into groups to form multiple network parameter combination groups, among which the parameter combinations with higher fitness have a greater chance of being retained and participating in the subsequent genetic operation. The group division is not only based on the sorting of fitness values, but also takes into account the diversity between parameter combinations, ensuring the extensive exploration of the understanding space and avoiding premature convergence to the local optimal solution. According to the network parameter combination group, multiple corresponding second network parameter combinations are generated. According to the crossover and mutation operations in the genetic algorithm, the crossover operation allows different parameter combinations to "exchange" their "genes", that is, certain network parameters, thereby generating new parameter combinations. The mutation operation introduces new genetic mutations by randomly changing certain parameter values in the parameter combination to increase the diversity of the population. These genetic operations imitate the genetic mutation mechanism in biological evolution, which helps the algorithm to jump out of the local optimum and explore a wider solution space. Through the crossover and mutation process, multiple second network parameter combinations are generated, and these parameter combinations are optimized. The fitness value of each parameter combination is calculated again, and selection, crossover and mutation operations are performed based on these fitness values. This iterative process is repeated continuously, and each generation searches for a better parameter combination through natural selection and genetic mechanisms based on the previous generation until the stopping condition is met, such as reaching a predetermined number of iterations or the fitness value no longer significantly improves. Finally, the iterative process generates the initial network parameter combination for each user node, which includes the initial weights and bias parameters of the multi-layer network.These initial parameter combinations represent the best performing network configurations during the genetic algorithm exploration process and are expected to generate images that closely match the user's text description.
[0073] In a specific embodiment, the process of executing step S106 may specifically include the following steps:
[0074] (1) The target network parameter combination is distributed to multiple user nodes through the central node, and the network parameter update amount of each user node is calculated separately. The network parameter update amount calculation function is: , represents the learning rate, represents the loss function of the kth user node, represents the gradient of the loss function with respect to the global parameters, represents the regularization parameter, represents the L2 norm, represents the global model parameters at time step t, The parameter update amount reported by the kth user node at time step t;
[0075] (2) According to the network parameter update amount, the network parameters of the improved cyclic variational autoencoder and multi-scale dynamic convolutional neural network of each user node are adjusted to generate the initial image generation model of each user node;
[0076] (3) Dynamically adjust the learning rate and weight the model performance feedback of the initial image generation model of each user node to obtain the model performance evaluation index of each initial image generation model;
[0077] (4) Iteratively optimize and globally update each initial image generation model according to the model performance evaluation indicators to generate the target image generation model.
[0078] Specifically, the target network parameter combination is distributed to each user node through the central node, and the target network parameter combination includes global model parameters optimized for generating images that match the user's text description. After receiving these parameters, each user node calculates the update amount of the network parameters based on its specific data, that is, the text description provided by the user. This calculation process uses a specific function involving the gradient of the loss function to the global parameters, as well as regularization terms to avoid overfitting. The calculation of the network parameter update amount is to further optimize the performance of the model on specific user data. By considering the loss function and regularization terms, each user node can determine how to adjust the received global parameters to better reflect its specific data set, that is, the user's text description. Based on the calculated network parameter update amount, each user node adjusts the parameters of its image generation model. This ensures that the model on each node can be optimized according to the specific needs of the user, thereby improving the quality and matching of the generated image. The improved cyclic variational autoencoder and multi-scale dynamic convolutional neural network improve the model's understanding of text descriptions and image generation capabilities by adjusting parameters. In order to further improve the model performance, the initial image generation model on each user node is dynamically adjusted in terms of learning rate and feedback weighting of model performance. The model training adjusts the learning rate according to the model's performance in the actual image generation process, and uses performance feedback to adjust the model weights to ensure that the model training process is both flexible and efficient and can quickly adapt to the needs of different users. Based on the model performance evaluation indicators, each initial image generation model is iteratively optimized and globally updated. Model performance evaluation indicators provide a means to quantify model performance. Through these indicators, we can identify which models perform best and which need further optimization. This information is used to guide the iterative optimization process of the model, continuously adjusting and improving the model parameters until the optimal performance is achieved and the target image generation model is generated.
[0079] The above describes the text-based image generation method in the embodiment of the present application. The following describes the text-based image generation device in the embodiment of the present application. Figure 2 In one embodiment of the present application, a text-based image generation device includes:
[0080] The receiving module 201 is used to receive image generation requests of multiple user nodes and parse to obtain initial text data of each user node, and perform deep encoding on the initial text data of each user node to obtain encoded text data of each user node;
[0081] Processing module 202, used for performing text feature enhancement processing on the encoded text data of each user node to obtain a text feature vector of each user node;
[0082] A training module 203 is used to distribute the improved cyclic variational autoencoder and the multi-scale dynamic convolutional neural network to each user node through the central node and perform image generation network training through the text feature vector to obtain a target output image for each user node;
[0083] The analysis module 204 is used to construct the initial network parameter combination of each user node according to the target output image, and perform global parameter analysis on the initial network parameter combination to obtain the target network parameter combination;
[0084] The optimization module 205 is used to distribute the target network parameter combination to multiple user nodes through the central node to perform network parameter update and iterative optimization to generate a target image generation model.
[0085] Through the collaboration of the above components, by receiving and parsing image generation requests from multiple user nodes, the model can perform deep encoding based on the initial text data provided by the user, and then generate images that are highly matched with user needs. It can understand and convert complex text descriptions to provide users with more personalized and accurate image generation services. By performing text feature enhancement processing on the encoded text data, the model not only captures the local features of the text data, but also extracts deep semantic information through the dynamic semantic memory network, significantly improving the model's understanding depth and accuracy of the text content. This is particularly important for understanding complex, ambiguous or polysemous text descriptions, which helps to generate richer and more delicate image content. The improved cyclic variational autoencoder and multi-scale dynamic convolutional neural network are used in combination with text feature vectors for image generation network training, which not only improves the image generation quality, but also optimizes the training process through advanced technologies such as attention mechanism. It can more effectively capture and utilize the relationship between text and image to generate more realistic and attractive images. Through the coordination of the central node, each user node completes model training and parameter update locally, and only model parameters rather than original data are uploaded and shared, effectively protecting the privacy of user data. This distributed training mechanism can also make full use of data from different users, improve the generalization ability of the model, and reduce the computing and storage pressure of the central server. Through global parameter analysis and the generation of target network parameter combinations, the model can be optimized according to the performance indicators fed back by all user nodes, ensuring the efficiency and accuracy of model updates. In addition, the use of optimization algorithms such as genetic algorithms further improves the scientific nature of parameter selection and model performance, so this application improves the efficiency of text-based image generation.
[0086] The present application also provides a text-based image generation device, which includes a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes the steps of the text-based image generation method in the above-mentioned embodiments.
[0087] The present application also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, wherein instructions are stored in the computer, and when the instructions are executed on a computer, the computer executes the steps of the text-based image generation method.
[0088] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, systems and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0089] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.
[0090] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A text-based image generation method, It is characterized in that The text-based image generation method comprises: Receive image generation requests from multiple user nodes and parse them to obtain initial text data of each user node, and perform deep encoding on the initial text data of each user node to obtain encoded text data of each user node; specifically include: receive image generation requests from multiple user nodes, and perform request parsing on the image generation requests to obtain initial text data of each user node; perform text preprocessing on the initial text data of each user node to obtain standard text data of each user node; perform text entity word extraction on the standard text data of each user node to obtain a text entity word set of each user node; perform Embedding vector encoding on the text entity word set of each user node to obtain a text encoding vector of each user node; perform text local feature extraction on the text encoding vector of each user node through a deep convolutional network to obtain a local feature vector of each user node; perform sequence dependency capture on the local feature vector of each user node through a cyclic text encoder to generate encoded text data of each user node; Performing text feature enhancement processing on the encoded text data of each user node to obtain a text feature vector of each user node; specifically comprising: inputting the encoded text data of each user node into a dynamic semantic memory network respectively; interacting with a pre-trained image-generated text database through the dynamic semantic memory network to generate deep semantic information of each user node; generating a memory state of each user node according to the deep semantic information; performing text feature enhancement on the memory state of each user node through the tanh function of the first fully connected layer in the dynamic semantic memory network, and outputting a first feature vector of each user node; performing feature vector conversion on the first feature vector of each user node through the Softmax function of the second fully connected layer in the dynamic semantic memory network to obtain a text feature vector of each user node; Distributing the improved cyclic variational autoencoder and the multi-scale dynamic convolutional neural network to each user node through the central node and performing image generation network training through the text feature vector to obtain a target output image of each user node, wherein the improved cyclic variational autoencoder includes a first encoding RNN layer, a second encoding RNN layer, an attention mechanism layer, and a decoding RNN layer; Constructing an initial network parameter combination of each user node according to the target output image, and performing global parameter analysis on the initial network parameter combination to obtain a target network parameter combination; The target network parameter combination is distributed to the multiple user nodes through the central node to perform network parameter update and iterative optimization to generate a target image generation model.
2. The text-based image generation method according to claim 1, It is characterized in that The improved cyclic variational autoencoder and the multi-scale dynamic convolutional neural network are distributed to each user node through the central node, and the image generation network is trained through the text feature vector to obtain the target output image of each user node, including: Distribute the improved cyclic variational autoencoder and multi-scale dynamic convolutional neural network to each user node through the central node; Inputting the text feature vector of each user node into the improved cyclic variational autoencoder and the multi-scale dynamic convolutional neural network, wherein the improved cyclic variational autoencoder includes a first encoding RNN layer, a second encoding RNN layer, an attention mechanism layer, and a decoding RNN layer; Performing encoding feature extraction on the text feature vector of each user node through the first encoding RNN layer to obtain a first encoding vector of each user node; Performing encoding feature extraction on the text feature vector of each user node through the second encoding RNN layer to obtain a second encoding vector of each user node; Performing attention mechanism weighted fusion on the first encoding vector and the second encoding vector through the attention mechanism layer to obtain an attention weighted vector for each user node; Performing latent variable decoding on the attention weighted vector of each user node through the decoding RNN layer to obtain latent variable data of each user node; The multi-scale dynamic convolutional neural network is used to generate an image of the latent variable data of each user node to obtain a target output image of each user node.
3. The text-based image generation method according to claim 1, It is characterized in that The initial network parameter combination of each user node is constructed according to the target output image, and a global parameter analysis is performed on the initial network parameter combination to obtain a target network parameter combination, including: Performing a matching analysis on the target output image and the initial text data to obtain a matching index of each target output image; Constructing an initial network parameter combination for each user node according to the matching index by using a genetic algorithm, wherein the initial network parameter combination includes initial weights and bias parameters of a multi-layer network; The initial network parameter combination of each user node is sent to the central node, and the central node performs a weighted average operation on the initial weight and bias parameters of each layer of the network in the initial network parameter combination to obtain the target weight and bias parameters of each layer of the network; Generate the corresponding target network parameter combination according to the target weight and bias parameters of each layer of the network.
4. The text-based image generation method according to claim 3, It is characterized in that The initial network parameter combination of each user node is constructed according to the matching index by using a genetic algorithm, and the initial network parameter combination includes initial weights and bias parameters of a multi-layer network, including: Defining an optimization objective function for each user node according to the matching index, and initializing a network parameter population through a genetic algorithm to obtain a plurality of first network parameter combinations; Calculating the fitness value of each first network parameter combination respectively by using the optimization objective function, and dividing the plurality of first network parameter combinations into groups according to the fitness values to obtain a plurality of network parameter combination groups; Generate corresponding multiple second network parameter combinations according to the multiple network parameter combination groups, and optimize the multiple second network parameter combinations to obtain an initial network parameter combination for each user node, wherein the initial network parameter combination includes initial weights and bias parameters of the multi-layer network.
5. The text-based image generation method according to claim 1, It is characterized in that The method of distributing the target network parameter combination to the multiple user nodes through the central node to update and iteratively optimize the network parameters to generate a target image generation model includes: The target network parameter combination is distributed to the multiple user nodes through the central node, and the network parameter update amount of each user node is calculated respectively, wherein the network parameter update amount calculation function is: , represents the learning rate, represents the loss function of the kth user node, represents the gradient of the loss function with respect to the global parameters, represents the regularization parameter, represents the L2 norm, represents the global model parameters at time step t, The parameter update amount reported by the kth user node at time step t; According to the network parameter update amount, the improved cyclic variational autoencoder and the multi-scale dynamic convolutional neural network of each user node are respectively adjusted to generate an initial image generation model for each user node; The learning rate of the initial image generation model of each user node is dynamically adjusted and the model performance feedback is weighted to obtain the model performance evaluation index of each initial image generation model; Each initial image generation model is iteratively optimized and globally updated according to the model performance evaluation index to generate a target image generation model.
6. A text-based image generation device, It is characterized in that The text-based image generation device comprises: A receiving module is used to receive image generation requests from multiple user nodes and parse them to obtain initial text data of each user node, and perform deep encoding on the initial text data of each user node to obtain encoded text data of each user node; specifically comprising: receiving image generation requests from multiple user nodes, and performing request parsing on the image generation requests to obtain initial text data of each user node; performing text preprocessing on the initial text data of each user node to obtain standard text data of each user node; performing text entity word extraction on the standard text data of each user node to obtain a text entity word set of each user node; performing Embedding vector encoding on the text entity word set of each user node to obtain a text encoding vector of each user node; performing text local feature extraction on the text encoding vector of each user node through a deep convolutional network to obtain a local feature vector of each user node; and performing sequence dependency capture on the local feature vector of each user node through a cyclic text encoder to generate encoded text data of each user node; A processing module is used to perform text feature enhancement processing on the encoded text data of each user node to obtain a text feature vector of each user node; specifically comprising: inputting the encoded text data of each user node into a dynamic semantic memory network respectively; interacting with a pre-trained image-generated text database through the dynamic semantic memory network to generate deep semantic information of each user node; generating a memory state of each user node according to the deep semantic information; performing text feature enhancement on the memory state of each user node through the tanh function of the first fully connected layer in the dynamic semantic memory network, and outputting a first feature vector of each user node; performing feature vector conversion on the first feature vector of each user node through the Softmax function of the second fully connected layer in the dynamic semantic memory network to obtain a text feature vector of each user node; A training module, used to distribute the improved cyclic variational autoencoder and the multi-scale dynamic convolutional neural network to each user node through a central node and perform image generation network training through the text feature vector to obtain a target output image of each user node, wherein the improved cyclic variational autoencoder includes a first encoding RNN layer, a second encoding RNN layer, an attention mechanism layer, and a decoding RNN layer; An analysis module, used to construct an initial network parameter combination of each user node according to the target output image, and perform global parameter analysis on the initial network parameter combination to obtain a target network parameter combination; The optimization module is used to distribute the target network parameter combination to the multiple user nodes through the central node to perform network parameter update and iterative optimization to generate a target image generation model.
7. A text-based image generation device, It is characterized in that The text-based image generation device comprises: a memory and at least one processor, wherein instructions are stored in the memory; The at least one processor calls the instructions in the memory to enable the text-based image generation device to perform the text-based image generation method according to any one of claims 1-5.
8. A computer-readable storage medium having instructions stored thereon, It is characterized in that When the instructions are executed by a processor, the text-based image generation method according to any one of claims 1 to 5 is implemented.
