A method for generating an image

By predicting and generating scenes and resource data after interaction between game characters, the problems of high cost of traditional game screen design and lag in operation are solved, achieving a richer and smoother gaming experience.

CN118949413BActive Publication Date: 2024-12-24SHENZHEN SHANGMI NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411449073.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-17
Publication Date
2024-12-24
Estimated Expiration
2044-10-17

AI Technical Summary

Technical Problem

Traditional game screen design leads to high development costs, high hardware requirements and lag in game operation. Directly generating screens may lead to problems such as content splitting and surge in computing volume.

Method used

By predicting the scene and resource data after the character interaction, deep learning algorithms and generative models are used to generate target interaction images in real time during interaction, improving the richness and fluency of the game screen.

Benefits of technology

It reduces development costs, avoids the problem of fragmentation of the screen content and the surge in computing volume, and improves the game experience and content interactivity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118949413B_ABST
    Figure CN118949413B_ABST
Patent Text Reader

Abstract

The present invention proposes an image generation method, which includes: obtaining behavior data and calculating the possibility of triggering a specific scene; when the trigger possibility is higher than a preset trigger threshold, predicting the scene data and interaction resource data after the character interacts with the scene according to the target scene data, interaction resource data and behavior data, and obtaining the target scene prediction data and interaction resource prediction data; when it is detected that the interaction between the character and the virtual resources in the game meets the preset trigger condition, generating the target interaction image according to the interaction data, the target scene prediction data and the interaction resource prediction data with the help of an interaction image generation model, and by means of the above method, the interactivity and richness of the game content are improved, thereby improving the game experience of the players.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to an image generating method. Background Art

[0002] In the field of game development, game graphics are an important determinant of the gaming experience. Traditional game graphics are achieved by rendering and loading preset image resources, and all graphics rely on image resources produced during the development process. However, with the increasing complexity of game scenes and the continuous enrichment of game plots, higher requirements are placed on the design of graphics during the development process. A large amount of graphics design work not only increases the cost of game development, but also places higher requirements on the hardware for running the game.

[0003] Although the development and operation costs can be controlled to a certain extent by reusing resources, this will lead to the problem of repeated screens, which will reduce the gaming experience. The random generation of screens can avoid repeated screens to a certain extent. However, generating random screens when triggering interactions will lead to a surge in game computing, causing freezes or program crashes, and the directly generated game screens often have a strong sense of separation from the previous screen content, resulting in a poor actual experience. Summary of the invention

[0004] In view of the above-mentioned limitations, the present invention proposes an image generation method, which predicts the scene and interaction resources after the character interaction in advance, and generates an interactive image in real time according to the interaction data when the interaction is triggered, thereby improving the richness and smoothness of the game screen and the player's gaming experience.

[0005] To achieve the above object, the present invention adopts the following technical solutions:

[0006] A method for generating an image, the method comprising the following steps:

[0007] Step 1: Obtain the character's behavior data within a preset time period and calculate the possibility of triggering a specific scenario;

[0008] Step 2: when the trigger possibility is higher than a preset trigger threshold, the scene data and interaction resource data after the character interacts with the scene are predicted according to the target scene data, the interaction resource data and the behavior data to obtain the target scene prediction data and the interaction resource prediction data;

[0009] Step 3: When it is detected that the interaction between the character and the virtual resources in the game meets the preset trigger conditions, a target interaction image is generated with the help of an interaction image generation model based on the interaction data, the target scene prediction data and the interaction resource prediction data.

[0010] Furthermore, step 2 specifically includes:

[0011] Step 21: Obtain target scene data and interactive resource data;

[0012] The target scene data includes: model data, texture information, lighting parameters, and position viewing angle data;

[0013] The interactive resource data includes: interactive role data, interactive prop data, and interactive action data;

[0014] Step 22: After preprocessing the target scene data and the behavior data, input them into a scene prediction model to obtain target scene prediction data;

[0015] Step 23: After pre-processing the interaction resource data and the behavior data, input them into an interaction prediction model to obtain interaction resource prediction data.

[0016] The scenario prediction model and the interaction prediction model are both trained using deep learning algorithms.

[0017] Furthermore, step 3 specifically includes:

[0018] Step 31: Obtain interaction data between the character and the virtual resource, and detect whether the preset scene triggering condition is met;

[0019] Step 32: When the preset scene triggering condition is met, the interaction data, the target scene prediction data, and the interaction resource prediction data are input into the interaction image generation model to obtain the target interaction image.

[0020] The interactive image generation model is an image generation model trained with the help of a generative model.

[0021] Compared with the prior art, the present invention has the following advantages:

[0022] (1) Generate specific image resources based on real-time scenes and character behaviors, improve the interactivity and richness of game content, and thus enhance the player's gaming experience; at the same time, there is no need to pre-design a large number of images during development, thus reducing development costs;

[0023] (2) Based on the prediction of character behavior, the target scene prediction data is obtained in advance, which avoids the problem of strong sense of fragmentation of picture content caused by directly generating interactive images. It also avoids the problem of game lag and crash caused by the surge in computing power when directly generating interactive images.

[0024] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the following specifically cites a preferred embodiment and describes it in detail with the accompanying drawings as follows. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 The present invention provides a flowchart of an image generation method according to an embodiment of the present invention.

[0026] Figure 2 A structural diagram of a scene prediction model provided in an embodiment of the present invention.

[0027] Figure 3 A structural diagram of a VQ-VAE model provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0028] The following is an explanation of the implementation of the present invention by specific specific embodiments. People familiar with the technology can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present invention. In order to further understand the present invention, the present invention is further described in detail below in conjunction with the best embodiment.

[0029] The inventive point of the present invention lies in an image generation method, which obtains scene data and interaction resource data after interaction in advance based on the prediction of a specific scene triggered by a player character, and generates a target interaction image according to the interaction data after the scene is actually triggered.

[0030] like Figure 1 As shown, the method comprises the following steps:

[0031] Step 1: Obtain the character's behavior data within a preset time period and calculate the possibility of triggering a specific scenario;

[0032] Step 2: when the trigger possibility is higher than a preset trigger threshold, the scene data and interaction resource data after the character interacts with the scene are predicted according to the target scene data, the interaction resource data and the behavior data to obtain the target scene prediction data and the interaction resource prediction data;

[0033] Step 3: When it is detected that the interaction between the character and the virtual resources in the game meets the preset trigger conditions, a target interaction image is generated with the help of an interaction image generation model based on the interaction data, the target scene prediction data and the interaction resource prediction data.

[0034] Furthermore, step 2 specifically includes:

[0035] Step 21: Obtain target scene data and interactive resource data;

[0036] The target scene data includes: model data, texture information, lighting parameters, and position viewing angle data;

[0037] The interactive resource data includes: interactive role data, interactive prop data, and interactive action data;

[0038] Step 22: After preprocessing the target scene data and the behavior data, input them into a scene prediction model to obtain target scene prediction data;

[0039] Step 23: After pre-processing the interaction resource data and the behavior data, input them into an interaction prediction model to obtain interaction resource prediction data.

[0040] The scenario prediction model and the interaction prediction model are both trained using deep learning algorithms.

[0041] Furthermore, step 3 specifically includes:

[0042] Step 31: Obtain interaction data between the character and the virtual resource, and detect whether the preset scene triggering condition is met;

[0043] Step 32: When the preset scene triggering condition is met, the interaction data, the target scene prediction data, and the interaction resource prediction data are input into the interaction image generation model to obtain the target interaction image.

[0044] The interactive image generation model is an image generation model trained with the help of a generative model.

[0045] As an embodiment, step 1 specifically includes:

[0046] Step 11: When the character reaches a preset behavior detection point, the behavior data of the character within a preset time period is obtained;

[0047] The behavior data includes: character coordinate data, character status data, character action data, character prop data, and character appearance data;

[0048] Step 12: Calculate a scene trigger probability value based on the character's behavior data; the scene trigger probability value is used to indicate the possibility of triggering a specific scene.

[0049] As an embodiment, the scene trigger probability value can be calculated in the following way:

[0050] Step 121, determining whether the character behavior data is within a preset specific scene trigger range, and obtaining a character behavior detection result; the preset specific scene trigger range includes: a character coordinate range, a character state range, a character prop range, and a character appearance range;

[0051] Step 122: Calculate the scene trigger probability value based on the character behavior detection result; the scene trigger probability value is calculated as follows:

[0052]

[0053] in, r 1. r 2. r 3. r 4 refers to whether the character coordinate range is satisfied, whether the character status range is satisfied, whether the character prop range is satisfied, and whether the character appearance range is satisfied. r 1. r 2. r 3. r The value of 4 is 0 or 1, 1 means the corresponding range is met, and 0 means the corresponding range is not met.

[0054] As an embodiment, the scene prediction model is trained based on a deep learning model with the following structure:

[0055] refer to Figure 2 , the scene prediction model consists of an input layer, a self-attention layer, an enhanced feedforward network, a fusion layer and an output layer.

[0056] The input layer consists of a scene data embedding layer and a behavior data embedding layer;

[0057] The scene data embedding layer receives the target scene data, processes the model data and texture data in the target scene data using a convolutional neural network (CNN), processes the illumination data and the position data through a linear layer, and outputs a first scene feature;

[0058] The behavior data embedding layer uses a long short-term memory network (LSTM) to process the behavior data and output a first behavior feature.

[0059] The self-attention layer uses a multi-head self-attention mechanism to perform attention calculations on the first scene feature and the first behavior feature respectively, and concatenates the calculation results to obtain a first attention result; the first attention result is mapped through a linear layer to the original dimension to obtain a second attention result.

[0060] Specifically, the method of calculating attention on the first scene feature is as follows:

[0061]

[0062] in, Attention Scene is the attention calculation output result of the first scene feature, Q Scene is the query matrix of scene features, K Scene is the key matrix of scene features, V Scene is the value matrix of scene features, dk is the number of columns of the key matrix;

[0063] The query matrix, key matrix, and value matrix of scene features are calculated as follows:

[0064]

[0065]

[0066]

[0067] in, S is the first scene feature, W QS , W KS , W VS are weight matrices respectively.

[0068] The attention calculation of the first behavior feature is as follows:

[0069]

[0070] The specific parameter meanings and calculation methods correspond to the attention calculation content of the first scene feature, and will not be repeated here.

[0071] The enhanced feedforward network processes the second attention result in sequence through a first linear layer, a nonlinear activation function, a second linear layer, and a residual connection to obtain a feedforward network output result.

[0072] Specifically, the operation of the first linear layer is:

[0073]

[0074] in, X 1 is the output result of the first linear layer, X To enhance the input of the feedforward network (i.e. the second attention result), W L1 is the weight matrix, b L1 is the bias term.

[0075] The nonlinear activation function uses either ReLU or Leaky ReLU.

[0076] The operation of the second linear layer is:

[0077]

[0078] in, X 3 is the output result of the second linear layer, X2 is the output result of the nonlinear activation function. W L2 is the weight matrix, b L2 is the bias term.

[0079] The residual connection processing method is:

[0080]

[0081] in, X out For the final output, X 3 is the output result of the second linear layer, X is the input to the augmented feedforward network.

[0082] The fusion layer performs a fusion operation on the output result of the feedforward network and activates it using a nonlinear activation function to obtain a fusion processing result;

[0083] The fusion operation first uses a self-attention mechanism to calculate the importance weight, then performs weighted fusion on the output results of the feedforward network, and uses a nonlinear activation function to obtain the fusion feature results, which can be specifically expressed as follows:

[0084]

[0085]

[0086]

[0087] in, Attention_weights is the importance weight, F concatenated is the output result of the feedforward network, W ac is the weight matrix, F used_output It is the result of fusion features.

[0088] The output layer is a linear layer.

[0089] The scene prediction model is trained by the following steps:

[0090] S1. Collect the target scene data and the character behavior data for training to form an original data set; preprocess the original data set; divide the original data set into a model training set, a model verification set and a model test set;

[0091] S2, initialize model parameters using Xavier initialization method;

[0092] S3. Determine the loss function and optimizer. The loss function uses the weighted sum of mean square error loss and cross entropy loss. The optimizer uses the Adam optimizer.

[0093] S4. In each training cycle, the input data of the model training set is fed into the model, the output and loss are calculated, and the model parameters are updated through back propagation. After each training cycle, the model performance is evaluated using the validation set, and the best model is saved.

[0094] S5. Monitor the loss and accuracy during training and adjust the learning rate or other hyperparameters as needed.

[0095] S6. Evaluate the final performance of the model on the model test set, record indicators such as accuracy and recall, and obtain the trained scenario prediction model.

[0096] The training method of the interactive prediction model is consistent with that of the scene prediction model, and uses the same model structure and training method, which will not be repeated here.

[0097] As an embodiment, the interactive image generation model is trained by means of a VQ-VAE model, referring to Figure 3 The VQ-VAE model consists of an encoder, a vector quantization module and a decoder. The specific structure is as follows:

[0098] The encoder consists of a scene data encoder, an interaction resource encoder, an interaction data encoder, and a feature fusion encoder;

[0099] The scene data encoder and the interactive resource encoder both use a convolutional neural network (CNN) structure to extract features of the target scene prediction data and the interactive resource prediction data to obtain target scene features and interactive resource features;

[0100] The interaction data encoder extracts the features of the interaction data using a recurrent neural network (RNN) structure to obtain interaction data features;

[0101] The feature fuser uses an attention mechanism to allow the features extracted by the interaction data encoder to selectively influence the features extracted by the scene data encoder and the interaction resource encoder.

[0102] The vector quantization module uses a codebook to map feature vectors into discrete indices.

[0103] The decoder uses any one of deconvolution and upsampling operations to restore the low-dimensional representation to a high-resolution image.

[0104] It should be noted that when training the interactive image generation model, in addition to the reconstruction loss and quantization loss, the loss function used also needs to introduce additional behavior consistency loss to ensure that the generated image can correctly reflect the interactive behavior characteristics of the character.

[0105] The behavior consistency loss can be implemented using a generative adversarial network loss function.

[0106] After introducing behavioral consistency loss, the total loss function can be expressed as:

[0107] L total = λ 1 L recon + λ 2 L vq + λ 3 L consistency

[0108] in, L recon , L vq 、L consistency They represent reconstruction loss, quantization loss and behavioral consistency loss respectively; 𝜆1, 𝜆2, 𝜆3 are the weight coefficients of the loss terms, which respectively control the importance of reconstruction loss, quantization loss and behavioral consistency loss in training.

[0109] The training method of the interactive image generation model is currently an existing technology, and those skilled in the art can successfully implement it based on the description of the aforementioned embodiments, and will not be described in detail here.

[0110] As an embodiment, the scene data encoder and the interactive resource encoder are composed of a combination of multiple convolutional layers and pooling layers, a fully connected layer, a batch normalization layer, and an activation function in sequence.

[0111] In the above structure, the introduction of the fully connected layer can help better map to the latent space, and the introduction of the batch normalization layer can speed up the training and help improve the stability of the model.

[0112] As an embodiment, the interactive data encoder is composed of an embedding layer, a recurrent neural network layer, and a fusion layer;

[0113] The embedding layer is used to process the features of different categories in the interaction data and convert these categories into low-dimensional vector representations;

[0114] The recurrent neural network layer uses a long short-term memory network (LSTM) or a gated recurrent unit (GRU) as the processing structure;

[0115] The fusion layer uses a multi-layer perceptron (MLP) or convolutional layer to integrate different types of features in the interaction data; its purpose is to help the model integrate the information of each feature and improve the overall performance.

[0116] As an embodiment, the specific implementation of the feature fuser is as follows:

[0117] The input of the feature fusion device is target scene features, interactive resource features and interactive data features;

[0118] This gives the feature vector before fusion: F concat =[ F scene ; F resource ; F interaction ],in F concat The feature vector before fusion, F scene , F resource , F interaction are target scene features, interactive resource features, and interactive data features respectively;

[0119] The calculation method of the attention weight vector of the target scene features, interactive resource features and interactive data features is:

[0120] A scene = softmax ( W a ・F scene )

[0121] A resource = softmax ( W a ・F resource )

[0122] A interaction = softmax ( W a ・F interaction )

[0123] in A scene , A resource , A interactionare the attention weight vectors of target scene features, interactive resource features, and interactive data features, respectively. W a is the weight matrix;

[0124] The features are weighted according to the attention weights as follows:

[0125] F Wscene = A scene ・F scene

[0126] F Wresource = A resource ・F resource

[0127] F Winteraction = A interaction ・F interaction

[0128] The above weighted features are concatenated and fused to obtain the fused feature vector F fused ;

[0129] The fused feature vector is input into the activation function and batch normalized to obtain the normalized feature vector; the specific method is:

[0130] F activated =ReLU ( F fused )

[0131] F norm =BatchNorm ( F activated )

[0132] The activation function uses the ReLU function;

[0133] The normalized feature vector is passed to the fully connected layer to obtain the final fused feature vector result. The processing method can be expressed as: F out =W out ・F norm +b out .

[0134] As an embodiment, the vector quantization module is implemented in the following manner:

[0135] Initializing a codebook to obtain an initial codebook vector, wherein the initial codebook vector is composed of a plurality of initial codebooks;

[0136] Taking the fused feature vector result obtained by the feature fuser as a basic vector, calculating the Euclidean distance between the basic vector and each initial codebook in the initial codebook vector;

[0137] The softmax function is used to calculate the weight of each initial codebook in the initial codebook vector to obtain the codebook weight vector; the calculation method is:

[0138] w i = softmax (- d i )

[0139] in, w i is the weight of the initial codebook vector i-th initial codebook, d i is the Euclidean distance between the initial codebook vector i-th initial codebook and the basic vector; the obtained codebook weight vector can be expressed as W codebook =[ w 1, w 2,…, w K ];

[0140] The reconstructed feature vector is generated according to the code book weight vector as follows:

[0141] F rc = W codebook ・C

[0142] in F rc To reconstruct the feature vector, C is the initial codebook vector.

[0143] As an embodiment, the decoder is composed of a fully connected layer, several decoding layers, several skip connection layers and a final convolutional layer connected in sequence.

[0144] The decoder transforms the input reconstructed feature vector using a fully connected layer to obtain an initial feature map, which is a high-dimensional feature map suitable for convolution processing.

[0145] The decoding layer is implemented using deconvolution or upsampling methods to expand the spatial size.

[0146] The skip connection layers pass features from certain layers of the encoder directly to the corresponding layers in the decoder to preserve high-resolution details.

[0147] The final convolutional layer adjusts the number of channels to that of the target image.

[0148] As an embodiment, in order to further improve the richness of the game screen, the following steps may be performed before performing step 21:

[0149] Step 20, calculating the screen repetition degree of the character within a preset time period, wherein the screen repetition degree refers to the difference degree of the screens of all specific mark points passed by the character within the preset time period.

[0150] When executing step 22, the picture repetition is used as an additional input and input into the scene prediction model together with the pre-processed behavior data and the target scene data.

[0151] Accordingly, when training the scenario prediction model, the model structure may be adjusted in any of the following ways:

[0152] (1) In the self-attention layer, when calculating the attention of the first scene feature, the picture repetition is introduced to affect the attention score of the scene feature. Specifically, the attention calculation method of the adjusted first scene feature is as follows:

[0153]

[0154] in, Attention Scene2 is the result of the first scene feature attention calculation after adjustment, R is the picture repetition, and the meaning and calculation method of other parameters remain unchanged.

[0155] (2) In the enhanced feedforward network, the picture repetition is mapped to the same dimension as the output result of the feedforward network to obtain the picture repetition embedding value; the picture repetition embedding value is added to the output value of the nonlinear activation function as the input of the second linear layer. Specifically, the adjusted second linear layer operation method is as follows:

[0156]

[0157] in, x 3 is the output result of the second linear layer, x 2 is the output result of the nonlinear activation function. W r is the weight matrix of the picture repetition, R is the picture repetition, and the meaning and calculation method of other parameters remain unchanged.

[0158] As an embodiment, the picture repetition degree may be calculated in the following manner:

[0159] Step 20a1, obtaining the marked images of all the specific marked points that the character passes through within a preset time period, and generating a mean image;

[0160] The mean image is obtained as follows:

[0161]

[0162] in I mean is the mean image, N is the total number of labeled images obtained, I k For the k A labeled image of the labeled points;

[0163] Step 20a2: Calculate the picture repetition degree. The picture repetition degree is calculated as follows:

[0164]

[0165] Among them, R is the picture repetition, MSE ( I k ,I mean ) is the mean square error between the labeled image and the mean image of the kth labeled point.

[0166] As an embodiment, the picture repetition degree may also be calculated in the following manner:

[0167] Step 20b1, obtaining a screen histogram of all specific marking points that the character passes through within a preset time period, and calculating a mean histogram;

[0168] The mean histogram is obtained as follows:

[0169]

[0170] in H mean is the mean histogram, N is the total number of labeled images obtained, H k For the k The histogram of the image at each marked point;

[0171] Step 20b2: Calculate the picture repetition degree. The picture repetition degree is calculated as follows:

[0172]

[0173] Among them, R is the picture repetition,D ( H k ,H mean ) is the distance between the screen histogram of the k-th marking point and the mean histogram; the distance can be calculated by any one of the chi-square distance, Bhattacharyya distance, and KL divergence.

[0174] As an embodiment, the method of the present invention may be implemented in software and / or a combination of software and hardware, for example, may be implemented using an application specific integrated circuit (ASIC), a general purpose computer or any other similar hardware device.

[0175] The method described in the present invention can be implemented in the form of a software program, and the software program can be executed by a processor to implement the steps or functions described above. Similarly, the software program (including related data structures) can be stored in a computer-readable recording medium, such as a RAM memory, a magnetic or optical drive or a floppy disk and the like.

[0176] In addition, some steps or functions of the method described in the present invention may be implemented by hardware, for example, as a circuit that cooperates with a processor to execute each step or function.

[0177] In addition, a part of the method described in the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present application through the operation of the computer. The program instruction for calling the method described in the present invention may be stored in a fixed or removable recording medium, and / or transmitted through a data stream in a broadcast or other signal-bearing medium, and / or stored in a working memory of a computer device that runs according to the program instruction.

[0178] As an embodiment, the present invention also provides a device, which includes a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the device is triggered to run the methods and / or technical solutions based on the aforementioned multiple embodiments.

[0179] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.

[0180] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0181] In addition, the technical solutions between the various embodiments can be combined with each other, but it must be based on the fact that ordinary technicians in the field can implement it. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0182] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment as above, it is not used to limit the present invention. Any technician familiar with this profession can make some changes or modifications to equivalent embodiments of equivalent changes using the technical contents disclosed above without departing from the scope of the technical solution of the present invention. However, any simple modification, equivalent change and modification made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention still falls within the scope of the technical solution of the present invention.

Claims

1. An image generation method, characterized in that: The method comprises the following steps: Step 1: Obtain the character's behavior data within a preset time period and calculate the possibility of triggering a specific scenario; Step 2: when the trigger possibility is higher than a preset trigger threshold, the scene data and interaction resource data after the character interacts with the scene are predicted according to the target scene data, the interaction resource data and the behavior data to obtain the target scene prediction data and the interaction resource prediction data; Step 3: When it is detected that the interaction between the character and the virtual resources in the game meets the preset triggering condition, a target interaction image is generated by means of an interaction image generation model according to the interaction data, the target scene prediction data and the interaction resource prediction data; Wherein, step 3 specifically includes: Step 31: Obtain interaction data between the character and the virtual resource, and detect whether the preset scene triggering condition is met; Step 32: When the preset scene triggering condition is met, the interaction data, the target scene prediction data, and the interaction resource prediction data are input into the interaction image generation model to obtain the target interaction image; The interactive image generation model is trained with the help of the VQ-VAE model; The VQ-VAE model consists of an encoder, a vector quantization module and a decoder; The encoder is composed of a scene data encoder, an interactive resource encoder, an interactive data encoder and a feature fusion unit; The scene data encoder and the interactive resource encoder both adopt a convolutional neural network structure to extract features of the target scene prediction data and the interactive resource prediction data to obtain target scene features and interactive resource features; The interaction data encoder uses a recurrent neural network structure to extract features of the interaction data to obtain interaction data features; The feature fuser uses an attention mechanism to allow the features extracted by the interaction data encoder to selectively influence the features extracted by the scene data encoder and the interaction resource encoder; The scene data encoder and the interactive resource encoder are composed of a combination of multiple convolutional layers and pooling layers, a fully connected layer, a batch normalization layer, and an activation function in sequence; The interactive data encoder consists of an embedding layer, a recurrent neural network layer, and a fusion layer.

2. The method according to claim 1, characterized in that Step 1 specifically includes: Step 11: When the character reaches a preset behavior detection point, the behavior data of the character within a preset time period is obtained; Step 12: Calculate a scene trigger probability value based on the character's behavior data; the scene trigger probability value is used to indicate the possibility of triggering a specific scene.

3. The method according to claim 1, characterized in that Step 2 specifically includes: Step 21: Obtain target scene data and interactive resource data; The target scene data includes: model data, texture information, lighting parameters, and position viewing angle data; The interactive resource data includes: interactive role data, interactive prop data, and interactive action data; Step 22: After preprocessing the target scene data and the behavior data, input them into a scene prediction model to obtain target scene prediction data; Step 23: After pre-processing the interaction resource data and the behavior data, input them into an interaction prediction model to obtain interaction resource prediction data.

4. The method according to claim 3, characterized in that The scene prediction model is obtained based on deep learning model training, and the scene prediction model consists of an input layer, a self-attention layer, an enhanced feedforward network, a fusion layer and an output layer; The input layer consists of a scene data embedding layer and a behavior data embedding layer; The self-attention layer is implemented using a multi-head self-attention mechanism; The enhanced feedforward network processes the output result of the self-attention layer through the first linear layer, the nonlinear activation function, the second linear layer, and the residual connection in sequence to obtain the output result of the feedforward network; The fusion layer performs a fusion operation on the output result of the feedforward network and activates it using a nonlinear activation function to obtain a fusion processing result; The output layer is a linear layer.

5. The method according to claim 3, characterized in that: The interaction prediction model and the scenario prediction model use the same model structure and training method.

6. The method according to claim 1, characterized in that When training the interactive image generation model, a behavior consistency loss is introduced, and the behavior consistency loss can be implemented using a generative adversarial network loss function.

7. The method according to claim 1, characterized in that Calculate the screen repetition of the character within a preset time period, and use the screen repetition as an additional input, along with the pre-processed behavior data and target scene data, into the scene prediction model; When training a scenario prediction model, you can adjust the model structure in any of the following ways: In the self-attention layer, when calculating the attention of the first scene feature, the picture repetition is introduced to affect the attention score of the scene feature; In the enhanced feedforward network, the picture repetition is mapped to the same dimension as the output result of the feedforward network to obtain a picture repetition embedding value; the picture repetition embedding value is added to the output value of the nonlinear activation function as the input of the second linear layer.