Training method of scene layout prediction network and estimation method of scene layout

By obtaining the sample group and using the scene layout prediction network for word vector conversion and loss value calculation, the problem of low spatial layout prediction efficiency in natural language generated images is solved, automatic processing from text to scene layout information is realized, and prediction efficiency is improved. .

CN114036937BActive Publication Date: 2024-10-25BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202111302449.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-04
Publication Date
2024-10-25
Estimated Expiration
2041-11-04

AI Technical Summary

Technical Problem

In the existing technology, the task of generating images directly from natural language is difficult, and it is impossible to achieve fully automated processing from text to spatial location, resulting in low spatial layout prediction efficiency.

Method used

By obtaining multiple sample groups, performing word vector conversion processing, using the scene layout prediction network to predict the scene layout of the sample text, calculating the loss value and training the network, it achieves scene layout information prediction without manual participation.

Benefits of technology

It realizes fully automated processing from text to scene layout information, improving the efficiency of scene layout information prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114036937B_ABST
    Figure CN114036937B_ABST
Patent Text Reader

Abstract

The present disclosure is about a training method of a scene layout prediction network and a scene layout estimation method, the training method includes: obtaining multiple sample groups, each sample group includes sample text and target scene layout information corresponding to the sample text, the target scene layout information includes the annotation category information of the target object in the sample text, and the annotation size information and annotation position information of the target object; performing word vector conversion processing on the sample text in each sample group to obtain a sample word vector sequence corresponding to the sample text; performing scene layout prediction processing on the sample word vector sequence through an initial scene layout prediction network to obtain predicted scene layout information of the sample text; determining the loss value of the initial scene layout prediction network according to the difference between the predicted scene layout information of the sample text and the corresponding target scene layout information; training the initial scene layout prediction network according to the loss value of the initial scene layout prediction network to obtain the scene layout prediction network. The present disclosure can improve the efficiency of spatial layout prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of natural language processing, and in particular to a training method for a scene layout prediction network and a scene layout estimation method. Background Art

[0002] With the development of computer vision and natural language processing technology, it is now possible to generate corresponding images based on natural language, but the task of generating images directly based on natural language is relatively difficult. Spatial layout is an abstract expression of images, which helps to narrow the distribution difference between language and images and reduce the difficulty of generating images directly from natural language. Therefore, it is of great significance to decode the language space relationship of natural language into a two-dimensional spatial layout.

[0003] In the related technology, the user processes the text to be processed in advance, obtains the materials of the entities involved in the text to be processed, and manually adjusts the size of the materials. Then, the text to be processed and the materials are input into a pre-trained layout prediction network to obtain spatial layout information including the position and orientation of each material.

[0004] However, in the above method, the user needs to first understand the text to be processed and find the material of the corresponding size before obtaining the corresponding spatial layout information. It is impossible to achieve fully automated processing from text to spatial position, and the spatial layout prediction efficiency is low. Summary of the invention

[0005] The present disclosure provides a scene layout prediction network training method and a scene layout estimation method to at least solve the problem of low efficiency of spatial layout prediction in related technologies. The technical solution of the present disclosure is as follows:

[0006] According to a first aspect of an embodiment of the present disclosure, a training method for a scene layout prediction network is provided, comprising:

[0007] Acquire multiple sample groups, each of which includes sample text and target scene layout information corresponding to the sample text, wherein the target scene layout information includes annotation category information of a target object in the sample text, and annotation size information and annotation position information of the target object;

[0008] Performing word vector conversion processing on the sample text in each of the sample groups to obtain a sample word vector sequence corresponding to the sample text;

[0009] Performing scene layout prediction processing on the sample word vector sequence through an initial scene layout prediction network to obtain predicted scene layout information of the sample text, wherein the predicted scene layout information includes predicted category information of a target object in the sample text, predicted size information and predicted position information of the target object;

[0010] Determining a loss value of the initial scene layout prediction network according to a difference between the predicted scene layout information of the sample text and the corresponding target scene layout information;

[0011] According to the loss value of the initial scene layout prediction network, the initial scene layout prediction network is trained to obtain a scene layout prediction network.

[0012] In a possible implementation, performing word vector conversion processing on the sample text in each sample group to obtain a sample word vector sequence corresponding to the sample text includes:

[0013] Performing word vector conversion processing on the sample text to obtain an initial word vector sequence corresponding to the sample text;

[0014] According to the initial word vector sequence and the position index corresponding to each word segment in the sample text, a sample word vector sequence corresponding to the sample text is obtained.

[0015] In a possible implementation, performing word vector conversion processing on the sample text to obtain an initial word vector sequence corresponding to the sample text includes:

[0016] Perform sentence processing on the sample text to obtain sample sentences in the sample text;

[0017] For any of the sample sentences, perform word vector conversion processing on the sample sentence to obtain a word vector sequence corresponding to the sample sentence;

[0018] According to the word vector sequences corresponding to the sample sentences, an initial word vector sequence corresponding to the sample text is obtained, a classification mark for indicating the classification task is set at the starting position of the initial word vector sequence, and a separation mark is set between the word vector sequences of any two sample sentences.

[0019] In a possible implementation, performing word vector conversion processing on the sample sentence to obtain a word vector sequence corresponding to the sample sentence includes:

[0020] Performing word vector conversion processing on each of the word segments in the sample sentence to obtain a word vector corresponding to each of the word segments;

[0021] The word vectors corresponding to each of the word segments in the sample sentence are concatenated to obtain a word vector sequence corresponding to the sample sentence.

[0022] In a possible implementation, the sample group further includes size information of a sample image corresponding to the sample text, and determining the loss value of the initial scene layout prediction network according to the difference between the predicted scene layout information of the sample text and the corresponding target scene layout information includes:

[0023] Normalizing the predicted scene layout information of the sample text and the corresponding target scene layout information according to the size information of the sample image to obtain the normalized predicted scene layout information and the normalized target scene layout information;

[0024] The loss value of the initial scene layout prediction network is determined based on the difference between the normalized predicted scene layout information and the normalized target scene layout information.

[0025] In a possible implementation, the initial scene layout prediction network includes a transformer-based encoder and a transformer-based decoder, and the initial scene layout prediction network performs scene layout prediction processing on the sample word vector sequence to obtain predicted scene layout information of the sample text, including:

[0026] Encoding the sample word vector sequence by the encoder to obtain semantic features of the sample word vector sequence;

[0027] The semantic features are decoded by the decoder to obtain predicted scene layout information of the sample text.

[0028] According to a second aspect of an embodiment of the present disclosure, a method for estimating a scene layout is provided, the method comprising:

[0029] Perform word vector conversion processing on the text to be processed to obtain a word vector sequence corresponding to the text to be processed;

[0030] The word vector sequence is processed by a scene layout prediction network to obtain predicted scene layout information corresponding to the text to be processed, wherein the predicted scene layout information includes predicted category information of the target object in the text to be processed, predicted size information and predicted position information of the target object.

[0031] Wherein, the scene layout prediction network is trained by the scene layout prediction network training method described in any one of claims 1 to 6.

[0032] In a possible implementation manner, after obtaining the predicted scene layout information corresponding to the text to be processed, the method further includes:

[0033] According to the predicted scene layout information, a spatial layout image corresponding to the text to be processed is constructed.

[0034] In a possible implementation, constructing a spatial layout image corresponding to the text to be processed according to the predicted scene layout information includes:

[0035] Acquire a target image corresponding to each target object according to the predicted category information of each target object;

[0036] According to the predicted position information and the predicted size information corresponding to each target object, the target images corresponding to each target object are laid out to construct a spatial layout image corresponding to the text to be processed.

[0037] According to a third aspect of an embodiment of the present disclosure, a training device for a scene layout prediction network is provided, comprising:

[0038] An acquisition unit is configured to acquire a plurality of sample groups, each of which includes a sample text and target scene layout information corresponding to the sample text, wherein the target scene layout information includes annotation category information of a target object in the sample text, and annotation size information and annotation position information of the target object;

[0039] A conversion unit, configured to perform word vector conversion processing on the sample text in each sample group to obtain a sample word vector sequence corresponding to the sample text;

[0040] A prediction unit is configured to perform scene layout prediction processing on the sample word vector sequence through an initial scene layout prediction network to obtain predicted scene layout information of the sample text, wherein the predicted scene layout information includes predicted category information of a target object in the sample text, predicted size information and predicted position information of the target object;

[0041] A determination unit configured to determine a loss value of the initial scene layout prediction network according to a difference between the predicted scene layout information of the sample text and the corresponding target scene layout information;

[0042] The prediction unit is configured to execute training of the initial scene layout prediction network according to the loss value of the initial scene layout prediction network to obtain the scene layout prediction network.

[0043] In a possible implementation, the conversion unit includes:

[0044] A conversion subunit is configured to perform word vector conversion processing on the sample text to obtain an initial word vector sequence corresponding to the sample text;

[0045] The first processing sub-unit is configured to execute, according to the initial word vector sequence and the position index corresponding to each word segment in the sample text, to obtain a sample word vector sequence corresponding to the sample text.

[0046] In a possible implementation, the conversion subunit is further configured to execute:

[0047] Perform sentence processing on the sample text to obtain sample sentences in the sample text;

[0048] For any of the sample sentences, perform word vector conversion processing on the sample sentence to obtain a word vector sequence corresponding to the sample sentence;

[0049] According to the word vector sequences corresponding to the sample sentences, an initial word vector sequence corresponding to the sample text is obtained, a classification mark for indicating the classification task is set at the starting position of the initial word vector sequence, and a separation mark is set between the word vector sequences of any two sample sentences.

[0050] In a possible implementation, the conversion subunit is further configured to execute:

[0051] Performing word vector conversion processing on each of the word segments in the sample sentence to obtain a word vector corresponding to each of the word segments;

[0052] The word vectors corresponding to each of the word segments in the sample sentence are concatenated to obtain a word vector sequence corresponding to the sample sentence.

[0053] In a possible implementation, the sample group further includes size information of a sample image corresponding to the sample text, and the determining unit includes:

[0054] The second processing subunit is configured to normalize the predicted scene layout information of the sample text and the corresponding target scene layout information according to the size information of the sample image, so as to obtain the normalized predicted scene layout information and the normalized target scene layout information;

[0055] A determination subunit is configured to determine the loss value of the initial scene layout prediction network based on the difference between the normalized predicted scene layout information and the normalized target scene layout information.

[0056] In a possible implementation, the initial scene layout prediction network includes a transformer-based encoder and a transformer-based decoder, and the prediction unit includes:

[0057] an encoding subunit, configured to perform encoding processing on the sample word vector sequence through the encoder to obtain semantic features of the sample word vector sequence;

[0058] The decoding subunit is configured to perform decoding processing on the semantic feature through the decoder to obtain the predicted scene layout information of the sample text.

[0059] According to a fourth aspect of an embodiment of the present disclosure, there is provided a scene layout estimation device, including:

[0060] A processing unit is configured to perform word vector conversion processing on the text to be processed to obtain a word vector sequence corresponding to the text to be processed;

[0061] The prediction unit is configured to perform scene layout prediction processing on the word vector sequence through a scene layout prediction network to obtain predicted scene layout information corresponding to the text to be processed, wherein the predicted scene layout information includes predicted category information of a target object in the text to be processed, predicted size information and predicted position information of the target object,

[0062] Wherein, the scene layout prediction network is trained by the scene layout prediction network training method described in any one of claims 1 to 6.

[0063] In a possible implementation manner, the device further includes:

[0064] The construction unit is configured to construct a spatial layout image corresponding to the text to be processed according to the predicted scene layout information.

[0065] In a possible implementation, the construction unit includes:

[0066] an acquisition subunit, configured to acquire a target image corresponding to each target object according to the predicted category information of each target object;

[0067] The construction subunit is configured to execute layout of the target images corresponding to each target object according to the predicted position information and the predicted size information corresponding to each target object, and construct a spatial layout image corresponding to the text to be processed.

[0068] According to a fifth aspect of an embodiment of the present disclosure, there is provided an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement any one of the above methods.

[0069] According to a sixth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, characterized in that when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform any one of the above methods.

[0070] According to a seventh aspect of an embodiment of the present disclosure, a computer program product is provided, which enables the electronic device to perform any one of the above methods when the instructions in the computer-readable storage medium are executed by a processor of an electronic device.

[0071] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0072] The disclosed embodiment obtains a plurality of sample groups including sample texts and target scene layout information corresponding to the sample texts, and performs word vector conversion processing on the sample texts in each of the sample groups to obtain a sample word vector sequence corresponding to the sample text. The sample word vector sequence is subjected to scene layout prediction processing by an initial scene layout prediction network to obtain predicted scene layout information of the sample text. Furthermore, the loss value of the initial scene layout prediction network can be determined according to the difference between the predicted scene layout information of the sample text and the corresponding target scene layout information, and the initial scene layout prediction network can be trained according to the loss value of the initial scene layout prediction network to obtain a scene layout prediction network. According to the training method of the scene layout prediction network and the scene layout estimation method provided by the disclosed embodiment, a scene layout prediction network for predicting the scene layout information corresponding to the text can be trained, so that the category information, position information and size information of the target object contained in the text to be processed can be obtained without manual participation, and the full automation of the scene layout information prediction can be realized, thereby improving the efficiency of the scene layout information prediction.

[0073] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0075] Figure 1 is a flowchart of a method for training a scene layout prediction network according to an exemplary embodiment;

[0076] Figure 2 is a flowchart of a method for training a scene layout prediction network according to an exemplary embodiment;

[0077] Figure 3is a flowchart of a method for training a scene layout prediction network according to an exemplary embodiment;

[0078] Figure 4 is a flowchart of a method for training a scene layout prediction network according to an exemplary embodiment;

[0079] Figure 5 is a flowchart of a method for training a scene layout prediction network according to an exemplary embodiment;

[0080] Figure 6 is a flowchart of a method for training a scene layout prediction network according to an exemplary embodiment;

[0081] Figure 7 is a schematic diagram of a training method for a scene layout prediction network according to an exemplary embodiment;

[0082] Figure 8 is a schematic diagram of training a scene layout prediction network according to an exemplary embodiment;

[0083] Fig. 9 is a schematic diagram of a method for estimating scene layout according to an exemplary embodiment;

[0084] Fig.10 is a schematic diagram of a method for estimating scene layout according to an exemplary embodiment;

[0085] Fig.11 is a block diagram of a training device for a scene layout prediction network according to an exemplary embodiment;

[0086] Fig.12 is a block diagram of a scene layout estimation device according to an exemplary embodiment;

[0087] Fig.13 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0088] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0089] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure 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 interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0090] It should also be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.

[0091] In one embodiment, Figure 1 As shown, a training method for a scene layout prediction network is provided. This embodiment uses the method applied to a terminal as an example for illustration. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0092] In step 102, a plurality of sample groups are obtained, each sample group includes sample text and target scene layout information corresponding to the sample text, and the target scene layout information includes annotation category information of the target object in the sample text, and annotation size information and annotation position information of the target object.

[0093] In the disclosed embodiment, a large amount of (text information-scene layout information) can be collected in advance as a sample group, wherein the text information serves as the sample text, and the scene layout information serves as the target scene layout information corresponding to the sample text, that is, as the annotation information of the sample text.

[0094] Exemplarily, a large number of sample images can be collected in advance, and corresponding (text information-scene layout information) can be constructed based on each sample image. The text information is used to describe the sample image, and the scene layout information includes category information of the target object in the sample image, position information and size information of the target object in the sample image (when the scene layout information is used as the target scene layout information, the category information of the target object is called annotated category information, the size information is called annotated size information, and the position information is called annotated position information). The category information, position information and size information of the target object can be manually set by a person based on the sample image, or obtained by performing image recognition processing on the sample image, and the embodiments of the present disclosure do not specifically limit this.

[0095] After obtaining a large number of sample groups, you can build a training set based on the sample groups. Among them, i is the serial number of the sample group, t i ={w i1 ,…,w ik} is the sample text in the i-th sample group, w i1 represents the first word in the sample text of the i-th sample group, and k represents the number of words contained in the sample text of the i-th sample group. i ={(c i1 ,p i1 ,s i1 ),…,(c im ,p im ,s im ) is the target scene layout information corresponding to the sample text in the i-th sample group, where c i1 represents the labeling category information of the first target in the sample text of the i-th sample group, p i1 =(x,y) represents the marked position information of the first target object in the sample text of the i-th sample group, s i1 =(w,h) represents the annotation size information of the first target object in the sample text in the i-th sample group, and m represents the number of target objects in the sample text.

[0096] After the training set is constructed, the initial scene layout prediction network can be trained according to the constructed training set.

[0097] In step 104, word vector conversion is performed on the sample text in each sample group to obtain a sample word vector sequence corresponding to the sample text.

[0098] In the disclosed embodiment, each word segment in the sample text can be subjected to word vector conversion processing respectively, and the word vector corresponding to each word segment can be obtained. Then, based on the word vector corresponding to each word segment, a sample word vector sequence corresponding to the sample text can be obtained.

[0099] It should be noted that the embodiment of the present disclosure does not specifically limit the method of word vector conversion. Any word vector conversion method can be applied to the embodiment of the present disclosure, including but not limited to: one hot encoding, CBOW (Continuous Bag-Of-Words Mode) and Skip-Gram encoding conversion methods.

[0100] In step 106, the sample word vector sequence is processed for scene layout prediction through the initial scene layout prediction network to obtain predicted scene layout information of the sample text, and the predicted scene layout information includes predicted category information, predicted size information and predicted position information of the target object in the sample text.

[0101] In an embodiment of the present disclosure, after obtaining a sample word vector sequence corresponding to a sample text, the sample word vector sequence can be input into an initial scene layout prediction network to perform scene layout prediction processing on it through the initial scene layout prediction network. The output information of the initial scene layout prediction network is the predicted scene layout information corresponding to the sample text. The predicted scene layout information may include predicted category information of the target object in the sample text, predicted size information and predicted position information of the target object, wherein the predicted size information and predicted position information of the target object can be used to respectively characterize the position and size of the target object in the spatial layout image.

[0102] Since the sample text contains information such as the target object (or entity), attributes and relationships, the initial scene layout prediction network can map the target object description to the image space through learning, and use attributes and relationships as constraints to further control the size and position of the object in the spatial layout image to obtain the predicted scene layout information, so that a spatial layout image that matches the sample text can be constructed based on the predicted scene layout information.

[0103] For example, taking the sample text "A tea table and a double sofa are placed opposite the TV wall. Green plants are placed on one side of the sofa, and a carpet is placed at the bottom of the tea table" as an example, after the sample text is processed by word vector conversion, the sample word vector sequence corresponding to the sample text is obtained. After the sample word vector sequence is input into the initial scene layout prediction network, the predicted scene layout information of the sample text can be obtained, including: (TV wall, position 1, size 1), (tea table, position 2, size 2), (double sofa, position 3, size 3), (Green plants, position 4, size 4), (carpet, position 5, size 5).

[0104] In step 108, the loss value of the initial scene layout prediction network is determined according to the difference between the predicted scene layout information of the sample text and the corresponding target scene layout information.

[0105] In the disclosed embodiment, after obtaining the predicted scene layout information corresponding to the sample text, the loss value of the initial scene layout prediction network can be determined by using the difference between the predicted scene layout information of the sample text and the target scene layout information corresponding to the sample text.

[0106] It should be noted that the method for calculating the loss value of the initial scene layout prediction network is not limited in the disclosed embodiment. In this example, the cross-entropy loss method is used to calculate the first recognition loss value of the predicted category information, and the smooth-L1 loss calculation method is used to determine the second recognition loss value of the predicted position information and the predicted size information. By fusing the first recognition loss value with the second recognition loss value, the loss value of the initial scene layout prediction network can be obtained.

[0107] In step 110, the initial scene layout prediction network is trained according to the loss value of the initial scene layout prediction network to obtain the scene layout prediction network.

[0108] In the disclosed embodiment, after obtaining the loss value of the initial scene layout prediction network, if the loss value does not meet the training requirements (for example, the loss value is greater than or equal to a preset loss threshold), the network parameters of the initial scene layout prediction network can be adjusted according to the loss value, and the aforementioned training process can be iterated repeatedly until the loss value of the initial scene layout prediction network meets the training requirements (for example, the loss value is less than the preset loss threshold), and then the training is terminated to obtain the scene layout prediction network.

[0109] After the scene layout prediction network is trained, the scene layout prediction network can be used to perform scene layout prediction processing on the text to be processed to obtain the predicted scene layout information corresponding to the text to be processed, and then the corresponding spatial layout image is constructed according to the predicted scene layout information corresponding to the text to be processed.

[0110] The disclosed embodiment obtains a plurality of sample groups including sample texts and target scene layout information corresponding to the sample texts, and performs word vector conversion processing on the sample texts in each of the sample groups to obtain a sample word vector sequence corresponding to the sample text. The sample word vector sequence is subjected to scene layout prediction processing by an initial scene layout prediction network to obtain predicted scene layout information of the sample text. Furthermore, the loss value of the initial scene layout prediction network can be determined according to the difference between the predicted scene layout information of the sample text and the corresponding target scene layout information, and the initial scene layout prediction network can be trained according to the loss value of the initial scene layout prediction network to obtain a scene layout prediction network. According to the training method of the scene layout prediction network provided in the disclosed embodiment, a scene layout prediction network for predicting the scene layout information corresponding to the text can be trained, so that the category information, position information and size information of the target object contained in the text to be processed can be obtained without manual participation, and the full automation of the scene layout information prediction can be realized, thereby improving the efficiency of the scene layout information prediction.

[0111] In one embodiment, referring to Figure 2As shown, in step 104, the sample text in each sample group is subjected to word vector conversion processing to obtain a sample word vector sequence corresponding to the sample text, which can be achieved by the following steps:

[0112] In step 202, the sample text is subjected to word vector conversion processing to obtain an initial word vector sequence corresponding to the sample text;

[0113] In step 204, a sample word vector sequence corresponding to the sample text is obtained based on the initial word vector sequence and the position index corresponding to each word segment in the sample text.

[0114] In the embodiment of the present disclosure, the sample text is text information composed of multiple word segments. Any word vector conversion method can be used to perform word vector conversion processing on each word segment in the sample text to obtain the word vector corresponding to each word segment in the sample text information, and then the initial word vector sequence corresponding to the sample text can be spliced ​​according to the word vector corresponding to each word segment. It should be noted that the embodiment of the present disclosure does not specifically limit the word vector conversion method.

[0115] Any word segment in the sample text has a corresponding position index. For any word segment, the position index corresponding to the word segment can be the position encoding information of the word segment, which can be used to identify the relative position or absolute position of the word segment in the sample text. Since the sequence information of each word segment cannot be known in the initial scene layout prediction network, but each word segment in the sample text corresponding to the input sample word vector sequence has a sequential relationship, it is possible to obtain the position index corresponding to each word segment in the sample text, and then add it to the word vector corresponding to each word segment to obtain the sample word vector sequence corresponding to the sample text, so that the initial scene layout prediction network can learn the sequential relationship between each word segment in the sample text to better predict the relationship between words. Among them, the position index has the same dimension d as the word vector of the word segment. model Therefore, the position index is added to the word vector of the word segmentation, that is, each dimension of the position index is added to each dimension of the word vector respectively.

[0116] Exemplarily, the position index of a word may be determined by using a sin function and a cos function, referring to the following formula (1):

[0117]

[0118] Among them, PE () It can represent the position code corresponding to each element in the position index, pos represents the number of word segments, and i represents the i-th element in the position index. For example, for the first word pos=1, d model =512 dimensions, and its position index is:

[0119]

[0120] The training method of the scene layout prediction network provided by the embodiment of the present disclosure can obtain a sample word vector sequence of the sample text through the word vector and position index of each word segment in the sample text, and introduce the sequential relationship of each word segment in the sample text into the sample word vector sequence through the position index, so that the initial scene layout prediction network can learn the sequential relationship of each word segment and better learn the correlation of the word segment based on the sequential relationship, which can improve the prediction accuracy of the initial scene layout prediction network for the sample text.

[0121] In one embodiment, referring to Figure 3 As shown, in step 202, the sample text is subjected to word vector conversion processing to obtain an initial word vector sequence corresponding to the sample text, which can be specifically achieved by the following steps:

[0122] In step 302, the sample text is segmented to obtain sample sentences in the sample text;

[0123] In step 304, for any sample sentence, the sample sentence is subjected to word vector conversion processing to obtain a word vector sequence corresponding to the sample sentence;

[0124] In step 306, an initial word vector sequence corresponding to the sample text is obtained based on the word vector sequence corresponding to each sample sentence. A classification identifier for indicating the classification task is set at the starting position of the initial word vector sequence, and a separator identifier is set between the word vector sequences of any two sample sentences.

[0125] In the embodiment of the present disclosure, when the sample text includes multiple sample sentences, the sample text can be processed by sentence segmentation to obtain each sample sentence in the sample text. The embodiment of the present disclosure does not specifically limit the sentence segmentation method for the sample text, and any method that can divide the sample text into multiple sample sentences is applicable to the embodiment of the present disclosure.

[0126] After obtaining each sample sentence in the sample text, each sample sentence can be converted into a word vector to obtain a word vector sequence corresponding to each sample sentence, and the word vector sequence corresponding to each sample sentence can be concatenated to obtain an initial word vector sequence corresponding to the sample text. In the process of concatenating the word vector sequence, a separator [SEP] can be set between the word vector sequences corresponding to each two sample sentences to obtain an initial concatenated word vector sequence, and a classification identifier [CLS] used to represent the classification task can be set at the starting position of the initial concatenated word vector sequence to obtain an initial word vector sequence corresponding to the sample text. Among them, [CLS] is a special symbol for classification output, and [SEP] is a special symbol used to separate non-continuous token sequences.

[0127] According to the training method of the scene layout prediction network provided by the embodiment of the present disclosure, non-continuous sample sentences can be separated in the initial word vector sequence by classification identifiers and separation identifiers, and initial scene layout prediction can be performed on the basis of sample sentences, so that the initial scene layout prediction network can better learn the semantic relationship between word segmentations, thereby improving the prediction accuracy of the initial scene layout prediction network for sample text.

[0128] In one embodiment, referring to Figure 4 As shown, in step 304, for any sample sentence, the sample sentence is subjected to word vector conversion processing to obtain a word vector sequence corresponding to the sample sentence, which can be specifically implemented by the following steps:

[0129] In step 402, each word in the sample sentence is converted into a word vector to obtain a word vector corresponding to each word;

[0130] In step 404, the word vectors corresponding to each word segment in the sample sentence are concatenated to obtain a word vector sequence corresponding to the sample sentence.

[0131] In the disclosed embodiment, in the process of performing word vector conversion processing on each word in the sample sentence, a pre-constructed word list can be obtained, and word vector conversion can be performed on each word according to the word list to obtain the word vector corresponding to each word.

[0132] Exemplarily, a large amount of text information may be used to construct a vocabulary in advance. In the embodiment of the present disclosure, the vocabulary is taken as a subword vocabulary. For example, a large amount of text information may be segmented using methods such as BPE (Byte Pair Encoding, double-byte encoding) and word piece to obtain a pre-constructed subword vocabulary, which includes multiple tokens, each of which corresponds to a subword element.

[0133] Taking the use of word pieces to construct a subword vocabulary as an example, the process of constructing the vocabulary is briefly described as follows: given a text information base, the initial subword vocabulary only contains all single characters (tokens), and then the most frequently occurring strings are continuously added to the subword vocabulary as new tokens until the size of the subword vocabulary reaches a preset size. For example: suppose the words and their occurrence times in the text information database are {'low': 5, 'lower': 2, 'newest': 6, 'widest': 3}, the initial subword vocabulary is {'l', 'o', 'w', 'e', ​​'r', 'n', 'w', 's', 't', 'i', 'd'}, and the string with the highest frequency is ('e', 's') 9 (that is, 6+3) times, so we add 'es' as a new token to the vocabulary database. Since 'es' appears as a whole in the subword vocabulary, the text information database can be expressed as {'low': 5, 'lower': 2, 'newest': 6, 'widest': 3}. At this time, the string with the highest frequency is ('es', 't') 9 (that is, 6+3) times. Add 'est' as a new token to the subword vocabulary, and the text information database is updated to {'lo w':5,'lowe r':2,'new est':6,'wi dest':3}, the new string with the highest frequency of occurrence is ('l','o')7 (i.e. 5+2) times, 'lo' is added to the subword vocabulary as a new token, and the text information database is updated to {'lo w':5,'lo we r':2,'new est':6,'wi dest':3}. This process is repeated until the subword vocabulary size reaches the preset target size, and the pre-constructed subword vocabulary is obtained.

[0134] After obtaining the pre-constructed vocabulary, the sample sentences can be converted to word vectors according to the vocabulary. For example: for any word in the sample sentence, traverse the vocabulary to find out whether there is a token that is the current word. If so, the word vector corresponding to the word can be obtained according to the position of the token in the vocabulary (in the word vector, the dimension corresponding to the token is 1, and the other dimensions are 0); otherwise, traverse the vocabulary to find out whether there is a token that is a subword of the word (that is, the string contained in the current word). If so, the token is one of the subwords representing the word. Iterate from the longest token in the vocabulary to the shortest token, and try to replace the substring in each word with the token. If there are still strings that have not been replaced at the end, but all tokens in the vocabulary have been iterated, replace the remaining strings with special tokens, such as <unk>, and then get the word vector corresponding to the word segmentation according to the subwords of the word segmentation.

[0135] After obtaining the word vectors corresponding to each word segment, the word vectors corresponding to each word segment can be connected according to the order of each word segment in the sample sentence, so as to obtain the word vector sequence corresponding to the sample sentence.

[0136] The training method of the scene layout prediction network provided by the embodiment of the present disclosure can alleviate the problem of decreased prediction accuracy caused by the segmentations that appear in the text to be processed but did not appear in the training stage during the application of the trained scene layout prediction network by performing word vector conversion processing on each segmentation in the sample sentence, and performing scene layout prediction processing based on the word vector sequence corresponding to the converted sample sentence, thereby improving the efficiency and accuracy of the scene layout prediction processing.

[0137] In one embodiment, the sample group also includes size information of the sample image corresponding to the sample text, referring to Figure 5 As shown, in step 108, the loss value of the initial scene layout prediction network is determined according to the difference between the predicted scene layout information of the sample text and the corresponding target scene layout information, which can be specifically achieved by the following steps:

[0138] In step 502, the predicted scene layout information of the sample text and the corresponding target scene layout information are normalized according to the size information of the sample image to obtain the normalized predicted scene layout information and the normalized target scene layout information;

[0139] In step 504, the loss value of the initial scene layout prediction network is determined based on the difference between the normalized predicted scene layout information and the normalized target scene layout information.

[0140] In the disclosed embodiment, the sample group may also include size information of a sample image used to construct the sample text. After obtaining the predicted scene layout information of the sample text, the predicted scene layout information of the sample text and the target scene layout information corresponding to the sample text may be normalized according to the size information of the sample image to obtain the normalized predicted scene layout information and the normalized target scene layout information. For example: the size information of the sample image may be used to normalize the predicted position information and predicted size information in the predicted scene layout information, and the size information of the sample image may be used to normalize the annotation position information and annotation size information in the target scene layout information.

[0141] Exemplarily, taking the process of normalizing the predicted scene layout information as an example, assuming that the size information of the sample image is (W, H), the predicted position information of the target object in the predicted scene layout information of the sample text is (x, y), and the predicted size information is (w, h), then the predicted position information of the target object can be normalized to (x / W, y / H) and the predicted size information of the target object can be normalized to (w / W, h / H) according to the size information of the sample image. The normalization process for the target scene layout information can refer to this process, and the embodiments of the present disclosure will not be described in detail.

[0142] After completing the normalization process, the second recognition loss value of the initial scene layout prediction network can be calculated based on the normalized predicted position information and predicted size information, and the normalized annotation position information and annotation size information, and then the loss value of the initial scene layout prediction network can be obtained based on the first recognition loss value and the second recognition loss value, and the initial scene layout prediction network can be trained based on the loss value. The specific training process can refer to the relevant description of the aforementioned embodiment, and the embodiments of the present disclosure will not be repeated here.

[0143] Due to the inconsistency of the sizes of the sample images, the iteration of the initial scene layout prediction network will be slow. The training method of the scene layout prediction network provided in the embodiment of the present disclosure can normalize the predicted scene layout information and the target scene layout prediction information according to the size information of the sample images, and use the normalized scene layout prediction information and the target scene layout prediction information to train the initial scene layout prediction network, which can improve the iteration speed of the initial scene layout prediction network, improve the training speed of the initial scene layout prediction network, and improve the stability of the trained scene layout prediction network.

[0144] In one embodiment, the initial scene layout prediction network includes a transformer-based encoder and a transformer-based decoder, referring to Figure 6 As shown, in step 106, the sample word vector sequence is subjected to scene layout prediction processing by the initial scene layout prediction network to obtain the predicted scene layout information of the sample text, which can be specifically achieved by the following steps:

[0145] In step 602, the sample word vector sequence is encoded by an encoder to obtain semantic features of the sample word vector sequence;

[0146] In step 604, the semantic features are decoded by a decoder to obtain predicted scene layout information of the sample text.

[0147] In the embodiment of the present disclosure, the initial scene layout prediction network is based on the transformer network structure. Figure 7 As shown, the initial scene layout prediction network 700 is implemented based on the transformer network structure, including a transformer-based encoder 702 and a transformer-based decoder 704. In this example, the encoder 702 is a structure including 6 self-attention layers. Each self-attention layer maps each element in the input sample word vector sequence to a key, a query, and a value. The correlation between the two elements is measured by calculating the similarity between the query and the key of the two elements, and the value is weighted and summed using the correlation to obtain a new feature vector, which is input into the next self-attention layer. By superimposing multiple self-attention structures, the initial scene layout prediction network can extract higher-level semantic features, thereby improving the prediction accuracy of the initial scene layout prediction network.

[0148] In the decoder 704, the feature vector output by the encoder 702 can be used as the decoder input, and the decoder 704 can serialize the predicted category information, predicted position information, predicted size information and other layout information of each target object in the output sample text. The decoder 704 also adopts the transformer structure and is also composed of multiple self-attention structures. The output head structure of each step can contain 3 branches, which can be specifically referred to Figure 8 As shown. One branch of the output head structure is the predicted category information of the target object. The predicted category information may include 80 dimensions, each of which may be used to represent the probability that the target object belongs to each object category. The other two branches are the predicted position information and the predicted size information, respectively. The predicted position information includes 2 dimensions (x, y), and the predicted size information includes 2 dimensions (w, h).

[0149] For example, refer to Figure 7 As shown, the content of sample image 706 is a girl in a blue sweater eating a hamburger, and the corresponding sample text is "A girl in blue sweater eating hurger". After the sample text is converted into a word vector, the corresponding sample word vector sequence is obtained. After the sample word vector sequence is input into the encoder 702, the encoder 702 can output the feature vector corresponding to the sample word vector sequence, and use the feature vector as the input information of the decoder 704. After the decoder 704 decodes the input feature vector, it serializes the output of the predicted scene layout information of the sample text, including the predicted category information of each target object, and the predicted location information, predicted size information and other predicted scene layout information. Figure 7 In the example shown, the predicted scene layout information may include (c1, p1, s1) and (c2, p2, s2), where c1 may be the predicted category information of the object "girl", p1 and s1 are respectively used to represent the predicted position information and predicted size information of the object "girl", and c2 may be the predicted category information of the object "burger", and p2 and s2 are respectively used to represent the predicted position information and predicted size information of the object "burger".

[0150] The training method of the scene layout prediction network provided by the embodiment of the present disclosure can extract objects in the sample text and establish a mapping from the text space to the scene position space, and narrow the modal difference between language and vision by spatially expressing the sample text. That is, the training method of the scene layout prediction network provided by the embodiment of the present disclosure can be used for the task of generating images from text information, decomposing it into two simple tasks of "text to scene layout" and "scene layout to image", and can generate more controllable and high-quality images.

[0151] In one embodiment, Fig. 9 As shown, a method for estimating scene layout is provided. This embodiment uses the method applied to a terminal as an example for illustration. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0152] In step 902, the text to be processed is subjected to word vector conversion processing to obtain a word vector sequence corresponding to the text to be processed.

[0153] For example, the text to be processed may be text information for generating a corresponding spatial layout image. In the embodiments of the present disclosure, there is no specific limitation on the method for obtaining the text to be processed, including but not limited to manually inputting the text to be processed by a user, or obtaining relevant description sentences from corresponding documents as the text to be processed.

[0154] For example, assuming that in a decoration scenario, the user wants to obtain a spatial layout image of a room, the user can describe the desired room layout: A tea table and a double sofa are placed opposite the TV wall. Green plants are placed on one side of the sofa, and a carpet is placed at the bottom of the tea table, and manually input the above information. In response to the user's input operation, the user's input "A tea table and a double sofa are placed opposite the TV wall. Green plants are placed on one side of the sofa, and a carpet is placed at the bottom of the tea table" is obtained as the text to be processed.

[0155] By performing word vector conversion on the text to be processed, a word vector sequence corresponding to the text to be processed can be obtained. It should be noted that the method of word vector conversion is not specifically limited in the embodiments of the present disclosure, and any word vector conversion method can be applied to the embodiments of the present disclosure, including but not limited to: one hot encoding, CBOW (Continuous Bag-Of-Words Mode) and Skip-Gram encoding conversion methods.

[0156] In step 904, the word vector sequence is processed by scene layout prediction through the scene layout prediction network to obtain predicted scene layout information corresponding to the text to be processed. The predicted scene layout information includes predicted category information of the target object in the text to be processed, predicted size information and predicted position information of the target object.

[0157] In the disclosed embodiment, the scene layout prediction network can be trained by any of the aforementioned scene layout prediction network training methods.

[0158] For example, after obtaining the word vector sequence corresponding to the text to be processed, the word vector sequence can be processed by a pre-trained scene layout prediction network to perform scene layout prediction processing, thereby obtaining the predicted scene layout information corresponding to the text to be processed. Exemplarily, the word vector sequence corresponding to the text to be processed can be used as input information of the scene layout prediction network, and the output information of the scene layout prediction network is the predicted scene layout information corresponding to the text to be processed, and the predicted scene layout information can include the predicted category information of the target object, the predicted position information of the target object in the spatial layout image, and the predicted size information.

[0159] The disclosed embodiment performs word vector conversion processing on the text to be processed to obtain the word vector sequence corresponding to the text to be processed, and then performs scene layout prediction processing on the word vector sequence through a scene layout prediction network to obtain the predicted scene layout information corresponding to the text to be processed, and the predicted scene layout information may include the predicted category information of the target object, the predicted position information of the target object, and the predicted size information. According to the scene layout estimation method provided by the disclosed embodiment, the scene layout information corresponding to the text to be processed can be predicted without human intervention, and the full automation of the scene layout information prediction can be realized, thereby improving the efficiency of the scene layout information prediction.

[0160] In an exemplary embodiment, in step 904, after obtaining the predicted scene layout information corresponding to the text to be processed, the method further includes:

[0161] According to the predicted scene layout information, a spatial layout image corresponding to the text to be processed is constructed.

[0162] In the disclosed embodiment, after obtaining the predicted scene layout information corresponding to the text to be processed, the image layout can be performed according to the predicted scene layout information to construct a spatial layout image. For example, the image materials corresponding to each target object in the text to be processed can be laid out accordingly according to the predicted scene layout information to obtain a spatial layout image.

[0163] The scene layout estimation method provided by the embodiment of the present disclosure can automatically identify the predicted category information, predicted position information and predicted size information of the target object in the text to be processed, and construct a corresponding spatial layout image based on the identified predicted category information, predicted position information and predicted size information, which can enrich the construction method of the spatial layout image and improve the construction efficiency of the spatial layout image.

[0164] In an exemplary embodiment, referring to Fig.10 As shown, according to the predicted scene layout information, the spatial layout image corresponding to the text to be processed is constructed, which can be specifically achieved by the following steps:

[0165] In step 1002, a target image corresponding to each target object is obtained according to the predicted category information of each target object;

[0166] In step 1004, the target images corresponding to the target objects are laid out according to the predicted position information and predicted size information corresponding to the target objects, so as to construct a spatial layout image corresponding to the text to be processed.

[0167] For example, the predicted scene layout information includes predicted category information, predicted position information and predicted size information of the target object. The predicted position information and predicted size information can be used to represent the position of the target object in the spatial layout image and the size of the target image respectively.

[0168] After obtaining the predicted scene layout information corresponding to the text to be processed, the target image corresponding to each target object can be obtained according to the predicted category information of each target object in the predicted scene layout information. Exemplarily, an image library can be pre-set, and the image library can include images corresponding to multiple object categories. The target image corresponding to the predicted category information of each target object can be obtained from the image library according to the predicted category information of each target object; or, the corresponding target image can be downloaded online according to the predicted category information of each target object as a keyword. The method for obtaining the target image is not specifically limited in the disclosed embodiment.

[0169] After obtaining the target images corresponding to each target object, the size of the target image can be adjusted according to the predicted size information corresponding to each target object. After adjusting to the size indicated by the predicted size information, the resized target image is placed at the position indicated by the predicted position information, thereby obtaining the spatial layout image corresponding to the text to be processed.

[0170] Taking the above example, the predicted scene layout information includes: (TV wall, position 1, size 1), (tea table, position 2, size 2), (double sofa, position 3, size 3), (Green plants, position 4, size 4), (carpet, position 5, size 5), then the target images corresponding to the target objects such as TV wall, tea table, double sofa, Green plants, carpet, etc. can be obtained respectively, and the size of the target image 1 corresponding to "TV wall" is adjusted according to size 1, the size of the target image 2 corresponding to "tea table" is adjusted according to size 2, the size of the target image 3 corresponding to "double sofa" is adjusted according to size 3, the size of the target image 4 corresponding to "Green plants" is adjusted according to size 4, and the size of the target image 5 corresponding to "carpet" is adjusted according to size 5. By placing the adjusted target image 1 at blank image position 1, the adjusted target image 2 at blank image position 2, the adjusted target image 3 at blank image position 3, the adjusted target image 4 at blank image position 4, and the adjusted target image 5 at blank image position 5, we can obtain the spatial layout image corresponding to the text to be processed "A tea table and a double sofa are placed opposite the TV wall. Green plants are placed on one side of the sofa, and a carpet is placed at the bottom of the tea table".

[0171] The scene layout estimation method provided by the embodiment of the present disclosure can automatically identify the predicted category information, predicted position information and predicted size information of the target object in the text to be processed, and automatically obtain the corresponding target image based on the predicted category information of the identified target object, and layout the target image according to the predicted position information and the predicted size information to construct a corresponding spatial layout image, which can enrich the construction method of the spatial layout image and improve the construction efficiency of the spatial layout image.

[0172] It should be understood that although Figure 1-Figure 10 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-Figure 10 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0173] It can be understood that the same / similar parts between the various embodiments of the above method in this specification can refer to each other, and each embodiment focuses on the differences from other embodiments. For related points, please refer to the description of other method embodiments.

[0174] Fig.11 is a block diagram of a training device for a scene layout prediction network according to an exemplary embodiment. Fig.11 The device includes an acquisition unit 1102, a conversion unit 1104, a prediction unit 1106, a determination unit 1108 and a prediction unit 1110.

[0175] The acquisition unit 1102 is configured to acquire a plurality of sample groups, each of which includes a sample text and target scene layout information corresponding to the sample text, wherein the target scene layout information includes annotation category information of a target object in the sample text, and annotation size information and annotation position information of the target object;

[0176] The conversion unit 1104 is configured to perform word vector conversion processing on the sample text in each sample group to obtain a sample word vector sequence corresponding to the sample text;

[0177] The prediction unit 1106 is configured to perform scene layout prediction processing on the sample word vector sequence through an initial scene layout prediction network to obtain predicted scene layout information of the sample text, wherein the predicted scene layout information includes predicted category information of a target object in the sample text, predicted size information and predicted position information of the target object;

[0178] A determining unit 1108 is configured to determine a loss value of the initial scene layout prediction network according to a difference between the predicted scene layout information of the sample text and the corresponding target scene layout information;

[0179] The prediction unit 1110 is configured to execute training of the initial scene layout prediction network according to the loss value of the initial scene layout prediction network to obtain the scene layout prediction network.

[0180] The embodiment of the present disclosure obtains a plurality of sample groups including sample texts and target scene layout information corresponding to the sample texts, and performs word vector conversion processing on the sample texts in each of the sample groups to obtain a sample word vector sequence corresponding to the sample text. The sample word vector sequence is subjected to scene layout prediction processing by an initial scene layout prediction network to obtain predicted scene layout information of the sample text. Furthermore, the loss value of the initial scene layout prediction network can be determined according to the difference between the predicted scene layout information of the sample text and the corresponding target scene layout information, and the initial scene layout prediction network can be trained according to the loss value of the initial scene layout prediction network to obtain a scene layout prediction network. According to the training device of the scene layout prediction network provided by the embodiment of the present disclosure, a scene layout prediction network for predicting the scene layout information corresponding to the text can be trained, so that the category information, position information and size information of the target object contained in the text to be processed can be obtained without human intervention, and the full automation of the scene layout information prediction can be realized, thereby improving the efficiency of the scene layout information prediction.

[0181] In an exemplary embodiment, the conversion unit 1104 includes:

[0182] A conversion subunit is configured to perform word vector conversion processing on the sample text to obtain an initial word vector sequence corresponding to the sample text;

[0183] The first processing sub-unit is configured to execute, according to the initial word vector sequence and the position index corresponding to each word segment in the sample text, to obtain a sample word vector sequence corresponding to the sample text.

[0184] In an exemplary embodiment, the conversion subunit 1104 is further configured to perform:

[0185] Perform sentence processing on the sample text to obtain sample sentences in the sample text;

[0186] For any of the sample sentences, perform word vector conversion processing on the sample sentence to obtain a word vector sequence corresponding to the sample sentence;

[0187] According to the word vector sequences corresponding to the sample sentences, an initial word vector sequence corresponding to the sample text is obtained, a classification mark for indicating the classification task is set at the starting position of the initial word vector sequence, and a separation mark is set between the word vector sequences of any two sample sentences.

[0188] In an exemplary embodiment, the conversion subunit is further configured to execute:

[0189] Performing word vector conversion processing on each of the word segments in the sample sentence to obtain a word vector corresponding to each of the word segments;

[0190] The word vectors corresponding to each of the word segments in the sample sentence are concatenated to obtain a word vector sequence corresponding to the sample sentence.

[0191] In an exemplary embodiment, the sample group further includes size information of a sample image corresponding to the sample text, and the determining unit 1108 includes:

[0192] The second processing subunit is configured to normalize the predicted scene layout information of the sample text and the corresponding target scene layout information according to the size information of the sample image, so as to obtain the normalized predicted scene layout information and the normalized target scene layout information;

[0193] A determination subunit is configured to determine the loss value of the initial scene layout prediction network based on the difference between the normalized predicted scene layout information and the normalized target scene layout information.

[0194] In an exemplary embodiment, the initial scene layout prediction network includes a transformer-based encoder and a transformer-based decoder, and the prediction unit includes:

[0195] an encoding subunit, configured to perform encoding processing on the sample word vector sequence through the encoder to obtain semantic features of the sample word vector sequence;

[0196] The decoding subunit is configured to perform decoding processing on the semantic feature through the decoder to obtain the predicted scene layout information of the sample text.

[0197] Fig.12 is a block diagram of a scene layout estimation device according to an exemplary embodiment. Fig.12 , the device includes a processing unit 1202 and a prediction unit 1204.

[0198] The processing unit 1202 is configured to perform word vector conversion processing on the text to be processed to obtain a word vector sequence corresponding to the text to be processed;

[0199] The prediction unit 1204 is configured to perform scene layout prediction processing on the word vector sequence through a scene layout prediction network to obtain predicted scene layout information corresponding to the text to be processed, wherein the predicted scene layout information includes predicted category information of a target object in the text to be processed, predicted size information and predicted position information of the target object,

[0200] Wherein, the scene layout prediction network is trained by any of the scene layout prediction network training methods described above.

[0201] The disclosed embodiment performs word vector conversion processing on the text to be processed to obtain a word vector sequence corresponding to the text to be processed, and then performs scene layout prediction processing on the word vector sequence through a scene layout prediction network to obtain predicted scene layout information corresponding to the text to be processed, and the predicted scene layout information may include predicted category information of the target object, predicted position information of the target object, and predicted size information. According to the scene layout estimation device provided by the disclosed embodiment, the scene layout information corresponding to the text to be processed can be estimated without human intervention, and the full automation of scene layout information prediction can be achieved, thereby improving the efficiency of scene layout information prediction.

[0202] In an exemplary embodiment, the apparatus further comprises:

[0203] The construction unit is configured to construct a spatial layout image corresponding to the text to be processed according to the predicted scene layout information.

[0204] In an exemplary embodiment, the construction unit comprises:

[0205] an acquisition subunit, configured to acquire a target image corresponding to each target object according to the predicted category information of each target object;

[0206] The construction subunit is configured to execute layout of the target images corresponding to each target object according to the predicted position information and the predicted size information corresponding to each target object, and construct a spatial layout image corresponding to the text to be processed.

[0207] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0208] Fig.13 1 is a block diagram of an electronic device 1300 for implementing the above-mentioned scene layout prediction network training method and scene layout estimation method according to an exemplary embodiment. For example, the electronic device 1300 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0209] Reference Fig.13 , the electronic device 1300 may include one or more of the following components: a processing component 1302 , a memory 1304 , a power component 1306 , a multimedia component 1308 , an audio component 1310 , an input / output (I / O) interface 1312 , a sensor component 1314 , and a communication component 1316 .

[0210] The processing component 1302 generally controls the overall operation of the electronic device 1300, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 1302 may include one or more processors 1320 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 1302 may include one or more modules to facilitate the interaction between the processing component 1302 and other components. For example, the processing component 1302 may include a multimedia module to facilitate the interaction between the multimedia component 1308 and the processing component 1302.

[0211] The memory 1304 is configured to store various types of data to support operations on the electronic device 1300. Examples of such data include instructions for any application or method operating on the electronic device 1300, contact data, phone book data, messages, pictures, videos, etc. The memory 1304 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic disk, an optical disk, or a graphene memory.

[0212] The power supply component 1306 provides power to the various components of the electronic device 1300. The power supply component 1306 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 1300.

[0213] The multimedia component 1308 includes a screen that provides an output interface between the electronic device 1300 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1308 includes a front camera and / or a rear camera. When the electronic device 1300 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0214] The audio component 1310 is configured to output and / or input audio signals. For example, the audio component 1310 includes a microphone (MIC), and when the electronic device 1300 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 1304 or sent via the communication component 1316. In some embodiments, the audio component 1310 also includes a speaker for outputting an audio signal.

[0215] I / O interface 1312 provides an interface between processing component 1302 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0216] The sensor assembly 1314 includes one or more sensors for providing various aspects of status assessment for the electronic device 1300. For example, the sensor assembly 1314 can detect the open / closed state of the electronic device 1300, the relative positioning of components, such as the display and keypad of the electronic device 1300, and the sensor assembly 1314 can also detect changes in the position of the electronic device 1300 or components of the electronic device 1300, the presence or absence of user contact with the electronic device 1300, the orientation or acceleration / deceleration of the device 1300, and the temperature change of the electronic device 1300. The sensor assembly 1314 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 1314 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1314 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0217] The communication component 1316 is configured to facilitate wired or wireless communication between the electronic device 1300 and other devices. The electronic device 1300 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 1316 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1316 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0218] In an exemplary embodiment, the electronic device 1300 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above methods.

[0219] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 1304 including instructions, and the above instructions can be executed by the processor 1320 of the electronic device 1300 to perform the above method. For example, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0220] In an exemplary embodiment, a computer program product is further provided. The computer program product includes instructions. The instructions can be executed by the processor 1320 of the electronic device 1300 to complete the above method.

[0221] It should be noted that the above-mentioned devices, electronic devices, computer-readable storage media, computer program products, etc. may also include other implementation methods according to the description of the method embodiments. The specific implementation methods can refer to the description of the relevant method embodiments, which will not be described one by one here.

[0222] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.

[0223] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.< / unk>

Claims

1. A training method for a scene layout prediction network, characterized in that: include: Acquire multiple sample groups, each of which includes sample text and target scene layout information corresponding to the sample text, wherein the target scene layout information includes annotation category information of a target object in the sample text, and annotation size information and annotation position information of the target object; Performing word vector conversion processing on the sample text in each of the sample groups to obtain a sample word vector sequence corresponding to the sample text; Performing scene layout prediction processing on the sample word vector sequence through an initial scene layout prediction network to obtain predicted scene layout information of the sample text, wherein the predicted scene layout information includes predicted category information of a target object in the sample text, predicted size information and predicted position information of the target object; Determining a loss value of the initial scene layout prediction network according to a difference between the predicted scene layout information of the sample text and the corresponding target scene layout information; According to the loss value of the initial scene layout prediction network, the initial scene layout prediction network is trained to obtain a scene layout prediction network.

2. The method according to claim 1, characterized in that The performing word vector conversion processing on the sample text in each sample group to obtain a sample word vector sequence corresponding to the sample text includes: Performing word vector conversion processing on the sample text to obtain an initial word vector sequence corresponding to the sample text; According to the initial word vector sequence and the position index corresponding to each word segment in the sample text, a sample word vector sequence corresponding to the sample text is obtained.

3. The method according to claim 2, characterized in that The performing word vector conversion processing on the sample text to obtain an initial word vector sequence corresponding to the sample text includes: Perform sentence processing on the sample text to obtain sample sentences in the sample text; For any of the sample sentences, perform word vector conversion processing on the sample sentence to obtain a word vector sequence corresponding to the sample sentence; According to the word vector sequences corresponding to the sample sentences, an initial word vector sequence corresponding to the sample text is obtained, a classification mark for indicating the classification task is set at the starting position of the initial word vector sequence, and a separation mark is set between the word vector sequences of any two sample sentences.

4. The method according to claim 3, characterized in that The performing word vector conversion processing on the sample sentence to obtain a word vector sequence corresponding to the sample sentence includes: Performing word vector conversion processing on each of the word segments in the sample sentence to obtain a word vector corresponding to each of the word segments; The word vectors corresponding to each of the word segments in the sample sentence are concatenated to obtain a word vector sequence corresponding to the sample sentence.

5. The method according to any one of claims 1 to 4, characterized in that The sample group also includes size information of a sample image corresponding to the sample text, and determining the loss value of the initial scene layout prediction network according to the difference between the predicted scene layout information of the sample text and the corresponding target scene layout information includes: Normalizing the predicted scene layout information of the sample text and the corresponding target scene layout information according to the size information of the sample image to obtain the normalized predicted scene layout information and the normalized target scene layout information; The loss value of the initial scene layout prediction network is determined according to the difference between the normalized predicted scene layout information and the normalized target scene layout information.

6. The method according to any one of claims 1 to 4, characterized in that The initial scene layout prediction network includes a transformer-based encoder and a transformer-based decoder. The initial scene layout prediction network performs scene layout prediction processing on the sample word vector sequence to obtain predicted scene layout information of the sample text, including: Encoding the sample word vector sequence by the encoder to obtain semantic features of the sample word vector sequence; The semantic features are decoded by the decoder to obtain predicted scene layout information of the sample text.

7. A method for estimating scene layout, characterized in that: The method comprises: Perform word vector conversion processing on the text to be processed to obtain a word vector sequence corresponding to the text to be processed; The word vector sequence is processed by a scene layout prediction network to obtain predicted scene layout information corresponding to the text to be processed, wherein the predicted scene layout information includes predicted category information of the target object in the text to be processed, predicted size information and predicted position information of the target object. Wherein, the scene layout prediction network is trained by the scene layout prediction network training method described in any one of claims 1 to 6.

8. The method according to claim 7, characterized in that After obtaining the predicted scene layout information corresponding to the text to be processed, the method further includes: According to the predicted scene layout information, a spatial layout image corresponding to the text to be processed is constructed.

9. The method according to claim 8, characterized in that The step of constructing a spatial layout image corresponding to the text to be processed according to the predicted scene layout information includes: Acquire a target image corresponding to each target object according to the predicted category information of each target object; According to the predicted position information and the predicted size information corresponding to each target object, the target images corresponding to each target object are laid out to construct a spatial layout image corresponding to the text to be processed.

10. A training device for a scene layout prediction network, characterized in that: include: An acquisition unit is configured to acquire a plurality of sample groups, each of which includes a sample text and target scene layout information corresponding to the sample text, wherein the target scene layout information includes annotation category information of a target object in the sample text, and annotation size information and annotation position information of the target object; A conversion unit, configured to perform word vector conversion processing on the sample text in each sample group to obtain a sample word vector sequence corresponding to the sample text; A prediction unit is configured to perform scene layout prediction processing on the sample word vector sequence through an initial scene layout prediction network to obtain predicted scene layout information of the sample text, wherein the predicted scene layout information includes predicted category information of a target object in the sample text, predicted size information and predicted position information of the target object; A determination unit configured to determine a loss value of the initial scene layout prediction network according to a difference between the predicted scene layout information of the sample text and the corresponding target scene layout information; The prediction unit is configured to execute training of the initial scene layout prediction network according to the loss value of the initial scene layout prediction network to obtain the scene layout prediction network.

11. The device according to claim 10, characterized in that The conversion unit comprises: A conversion subunit is configured to perform word vector conversion processing on the sample text to obtain an initial word vector sequence corresponding to the sample text; The first processing sub-unit is configured to execute, according to the initial word vector sequence and the position index corresponding to each word segment in the sample text, to obtain a sample word vector sequence corresponding to the sample text.

12. The device according to claim 11, characterized in that The conversion subunit is further configured to execute: Perform sentence processing on the sample text to obtain sample sentences in the sample text; For any of the sample sentences, perform word vector conversion processing on the sample sentence to obtain a word vector sequence corresponding to the sample sentence; According to the word vector sequences corresponding to the sample sentences, an initial word vector sequence corresponding to the sample text is obtained, a classification mark for indicating the classification task is set at the starting position of the initial word vector sequence, and a separation mark is set between the word vector sequences of any two sample sentences.

13. The device according to claim 12, characterized in that The conversion subunit is further configured to execute: Performing word vector conversion processing on each of the word segments in the sample sentence to obtain a word vector corresponding to each of the word segments; The word vectors corresponding to each of the word segments in the sample sentence are concatenated to obtain a word vector sequence corresponding to the sample sentence.

14. The device according to any one of claims 10 to 13, characterized in that The sample group also includes size information of a sample image corresponding to the sample text, and the determining unit includes: The second processing subunit is configured to normalize the predicted scene layout information of the sample text and the corresponding target scene layout information according to the size information of the sample image, so as to obtain the normalized predicted scene layout information and the normalized target scene layout information; A determination subunit is configured to determine the loss value of the initial scene layout prediction network based on the difference between the normalized predicted scene layout information and the normalized target scene layout information.

15. The device according to any one of claims 10 to 13, characterized in that The initial scene layout prediction network includes a transformer-based encoder and a transformer-based decoder, and the prediction unit includes: an encoding subunit, configured to perform encoding processing on the sample word vector sequence through the encoder to obtain semantic features of the sample word vector sequence; The decoding subunit is configured to perform decoding processing on the semantic feature through the decoder to obtain the predicted scene layout information of the sample text.

16. A scene layout estimation device, characterized in that: include: A processing unit is configured to perform word vector conversion processing on the text to be processed to obtain a word vector sequence corresponding to the text to be processed; The prediction unit is configured to perform scene layout prediction processing on the word vector sequence through a scene layout prediction network to obtain predicted scene layout information corresponding to the text to be processed, wherein the predicted scene layout information includes predicted category information of a target object in the text to be processed, predicted size information and predicted position information of the target object, Wherein, the scene layout prediction network is trained by the scene layout prediction network training method described in any one of claims 1 to 4.

17. The device according to claim 16, characterized in that The device also includes: The construction unit is configured to construct a spatial layout image corresponding to the text to be processed according to the predicted scene layout information.

18. The device according to claim 17, characterized in that The construction unit comprises: an acquisition subunit, configured to acquire a target image corresponding to each target object according to the predicted category information of each target object; The construction subunit is configured to execute layout of the target images corresponding to each target object according to the predicted position information and the predicted size information corresponding to each target object, and construct a spatial layout image corresponding to the text to be processed.

19. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method as claimed in any one of claims 1 to 9.

20. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the method as claimed in any one of claims 1 to 9.

21. A computer program product, comprising instructions, characterized in that: When the instructions are executed by a processor of an electronic device, the electronic device is enabled to perform the method as claimed in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Image text generation method based on visual attention

    CN110111399A

  • Text generation model training method and device and electronic equipment

    CN111709248A

  • Image processing model training method, image processing method and related equipment

    CN112232293A

  • Model training method and device, information generation method and device, equipment and medium

    CN113297974A

  • Natural Language Based Computer Animation

    US20180293050A1