Image generation method, modification relationship model generation method, device and equipment
By using the modification relationship to modify the text entered by the user on the set and input the modified text into the literary drawing model, the problem of poor text generation image generation in the prior art is solved, and higher accuracy and authenticity are achieved .
Patent Information
- Application Number
- CN202311451979.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-02
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2043-11-02
AI Technical Summary
In the prior art, the image effect generated by text still needs to be improved, especially when the user inputs less text content, the generated image does not match the user's expectations or has fewer details, resulting in poor picture quality.
By receiving the input text, using the pre-constructed modification relationship pair pair to determine the corresponding recommended text, and modify or improve the original text according to the user's selection operation, and finally input the modified text into the pre-trained literary graph model. Generate more accurate and realistic pictures.
The images generated by text are modified by accurate co-occurrence relationships, which improves the accuracy and authenticity of generated pictures, making the generated pictures more in line with the needs of users.
Smart Images

Figure CN117315094B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical fields of computer vision, deep learning, and natural language processing in the field of artificial intelligence, and can be applied to scenes such as virtual reality, medicine, design, and creativity, and in particular to a method for generating an image, a method for generating a modification relationship model, a device, and equipment. Background Art
[0002] With the development of artificial intelligence technology, artificial intelligence can be used to generate images from input text, that is, artificial intelligence models can be used to generate images from text.
[0003] In the process of realizing text-to-image generation, the user can input text, and the electronic device receiving the text can send the text or pre-process the text to the artificial intelligence model, and the artificial intelligence model generates a picture based on the text. At present, the effect of generating pictures from text still needs to be improved. Summary of the invention
[0004] The present disclosure provides a picture generation method, a modification relationship model generation method, a device and a device.
[0005] According to a first aspect of the present disclosure, a method for generating an image is provided, the method comprising: receiving a first text input for generating an image; determining a second text corresponding to the first text according to a pre-constructed set of modification relationship pairs, wherein the set of modification relationship pairs includes a first modification relationship pair extracted from a text; the second text includes at least part of the content of the first text; determining a third text according to a selection operation on the second text, the second text including the third text; and obtaining an output image corresponding to the third text by inputting the third text into a pre-trained text graph model, wherein the text graph model is used to generate a corresponding image according to the input text.
[0006] According to a second aspect of the present disclosure, a method for generating a modification relationship model is provided, the method comprising: constructing a training set based on an acquired fifth text and a second modification relationship pair having a modification relationship in the fifth text; using the training set to perform supervised fine-tuning on a pre-trained initial modification relationship model to obtain a fine-tuned modification relationship model; wherein the modification relationship model outputs a first modification relationship pair based on an input text, the first modification relationship pair is used to construct a modification relationship pair set, the modification relationship pair set is used to provide recommended text for an input text of a text-graph model, and the modification relationship model is a generative language model.
[0007] According to a third aspect of the present disclosure, a picture generating device is provided, the device comprising: a receiving unit, for receiving an input first text for generating a picture; a first determining unit, for determining a second text corresponding to the first text according to a pre-constructed set of modifying relationship pairs, wherein the set of modifying relationship pairs includes a first modifying relationship pair extracted from a text; the second text includes at least part of the content in the first text; a second determining unit, for determining a third text according to a selection operation on the second text, the second text including the third text; and a picture generating unit, for obtaining an output picture corresponding to the third text by inputting the third text into a pre-trained text-graph model, wherein the text-graph model is used to generate a corresponding picture according to the input text.
[0008] According to a fourth aspect of the present disclosure, a modification relationship model generation device is provided, the device comprising: a construction unit, for constructing a training set based on an acquired fifth text and a third modification relationship pair having a modification relationship in the fifth text; a training unit, for performing supervised fine-tuning on a pre-trained initial modification relationship model using the training set to obtain a fine-tuned modification relationship model; wherein the modification relationship model outputs a first modification relationship pair based on an input text, the first modification relationship pair is used to construct a modification relationship pair set, the modification relationship pair set is used to provide recommended text for an input text of a text graph model, and the modification relationship model is a generative language model.
[0009] According to a fifth aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the methods provided in the first and second aspects.
[0010] According to a sixth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the methods provided in the first aspect and the second aspect.
[0011] According to a seventh aspect of the present disclosure, a computer program product is provided, comprising: a computer program, wherein the computer program is stored in a readable storage medium, at least one processor of an electronic device can read the computer program from the readable storage medium, and the at least one processor executes the computer program so that the electronic device executes the method described in the first aspect and the second aspect.
[0012] According to the scheme of the present disclosure, a first text for generating a picture is received as input; a second text corresponding to the first text is determined according to a pre-constructed set of modification relationship pairs, wherein the set of modification relationship pairs includes a first modification relationship pair extracted from a text; the second text includes at least part of the content of the first text; a third text is determined according to a selection operation on the second text, wherein the second text includes the third text; an output picture corresponding to the third text is obtained by inputting the third text into a pre-trained text graph model, wherein the text graph model is used to generate a corresponding picture according to the input text, and since the above-mentioned second text is determined from the set of modification relationship pairs, other words in the second text other than the first text have a modification relationship with the first text, that is, have an accurate co-occurrence relationship, and thus the picture generated by the second text including words having an accurate co-occurrence relationship with the first text has better accuracy and stronger authenticity than the picture generated by the first text.
[0013] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0015] Figure 1 is a scene graph that can implement the embodiments of the present disclosure;
[0016] Figure 2 is a schematic diagram according to a first embodiment of the present disclosure;
[0017] Figure 3 is a schematic diagram according to a second embodiment of the present disclosure;
[0018] Figure 4 is a schematic diagram according to a third embodiment of the present disclosure;
[0019] Figure 5 is a scene graph of an embodiment of the present disclosure;
[0020] Figure 6 is a schematic diagram according to a fourth embodiment of the present disclosure;
[0021] Figure 7 is a schematic diagram according to a fifth embodiment of the present disclosure;
[0022] Figure 8 is a schematic diagram according to a sixth embodiment of the present disclosure;
[0023] Fig. 9is a schematic block diagram of an example electronic device that can be used to implement embodiments of the present disclosure. DETAILED DESCRIPTION
[0024] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0025] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0026] Please refer to Figure 1 , which shows a schematic diagram of an application scenario. Figure 1 As shown, the user can open the display interface 11 of the Wenshengtu application on the terminal device. The above display interface may display an input area 12. The user can enter text in the above input area 12. Schematically, the user can enter text in the above input area 12 by voice input or text input. The above display interface 11 also displays a picture generation control 13, and the picture generation control 13 may display information indicating that the control is a control for generating a picture, such as Figure 1 The user may trigger the image generation control 13 to issue an instruction to instruct the Wensheng graph application to generate an image corresponding to the text. The Wensheng graph application may use the Wensheng graph model to generate an image based on the text. The display interface 11 may display an image 14 generated by the Wensheng graph model.
[0027] In the above application scenarios, the text image application can generate images based on the text input by the user. However, in some application scenarios, due to the small amount of text content input by the user, for example, the input text content lacks a subject or modifier, the generated image will not match the user's expected image, or the generated image has few details and the image quality is poor. Therefore, it is necessary to improve the effect of the image generated by the text, so that the generated image can better meet the user's needs and make the generated image more realistic.
[0028] In order to improve the effect of pictures generated by text, after receiving the input text, recommended text can be displayed to the user. The above recommended text can be used to modify or improve the text input by the user, in the hope of modifying or improving the text input by the user to generate a better picture.
[0029] In some embodiments, a recommended text may be generated for a text input by a user based on content similarity. That is, after receiving the input text, the similarity with the input text may be determined to generate a recommended text. Such a method of generating recommended text requires pre-building a knowledge base and similarity calculation, so the cost is relatively high.
[0030] In some embodiments, the recommended text may be generated based on a co-occurrence relationship. A co-occurrence relationship refers to the co-occurrence phenomenon between different words in a language.
[0031] Specifically, multiple word pairs that co-occur in texts can be pre-determined from multiple texts. In the above-mentioned text map application, after the user inputs the text of the image to be generated, the recommended text of the text of the image to be generated can be determined based on the above-mentioned multiple word pairs. For example, the text of the image to be generated includes word B1. The above-mentioned pre-determined multiple co-occurring word pairs include co-occurring words B1 and B2, then the word pair including words B1 and B2 can be used as the recommended text.
[0032] In these embodiments, if there is no relationship between the co-occurring words, but they just co-appear in the text, that is, the determined co-occurrence relationship between the words is inaccurate. The recommended text generated based on the inaccurate co-occurrence relationship cannot accurately modify or improve the text input by the user, and thus cannot improve the effect of the picture generated by using the recommended text.
[0033] The present disclosure provides a method for generating an image, a method for generating a modification relationship model, an apparatus and a device, which are applied to technical fields such as computer vision, deep learning and natural language processing in the field of artificial intelligence, so as to achieve the purpose of improving the effect of images generated from texts according to accurate recommendation relationships.
[0034] Please refer to Figure 2 , Figure 2 is a schematic diagram of the first embodiment of the present disclosure, such as Figure 2 As shown, the picture generation method provided in this embodiment includes the following steps:
[0035] S201: Receive a first text input for generating a picture.
[0036] The execution subject of this embodiment may be a terminal device or a server. In this embodiment, the execution subject is described as a terminal device.
[0037] The terminal device may run a text-generating image application for generating images from text. The first text may be input by a user or sent by another electronic device that is in communication with the terminal device. That is, the need to generate images from text may be initiated by the user or by the electronic device according to an instruction.
[0038] The first text is any text input for generating an image. The first text may include characters, words, sentences, or words, phrases, sentences, etc.
[0039] S202: Determine a second text corresponding to the first text according to a pre-constructed set of modification relationship pairs, wherein the set of modification relationship pairs includes a first modification relationship pair extracted from the text; and the second text includes at least part of the content of the first text.
[0040] One or more first modification relationship pairs can be extracted from at least one text, and a modification relationship pair set can be formed by the one or more first modification relationship pairs. After receiving the first text, the first text can be matched with the first modification relationship pair set to obtain at least one second text. The second text includes all or part of the content of the first text.
[0041] The first modifying relationship pair in the modifying relationship pair set may include: a modifying word and a modified subject word. Specifically, the first modifying relationship pair may include a subject word and a modifying word modifying the subject word; a modifying word modifying a picture and multiple subject words in the picture.
[0042] Since the second text is determined from the set of modification relationship pairs, the other texts in the second text other than the first text have a modification relationship with the first text, so that the other words in the second text have a more accurate co-occurrence relationship with the first text.
[0043] S203: Determine a third text according to the received selection operation, where the second text includes the third text.
[0044] In some application scenarios, the at least one second text may be displayed for selection by the user. The user may perform a selection operation on the displayed at least one second text. The execution subject may determine a third text indicated by the selection operation according to the user's selection operation. The second text includes a third text, for example, the third text is one of the plurality of second texts.
[0045] S204: Input the third text into a pre-trained text-to-graph model to obtain an output image corresponding to the third text, wherein the text-to-graph model is used to generate a corresponding image according to the input text.
[0046] The above text-to-graph model can generate corresponding images based on the input text.
[0047] The execution subject may input the third text into the text-generated graph model. The text-generated graph model may be any model that generates a picture based on the input text, such as an Artificial Intelligence Generated Content (AIGC) model.
[0048] The second text includes a third text. The third text includes at least part of the content of the first text, as well as other texts that have a modifying relationship with the first text. The above-mentioned other texts may be, for example, the subject that is missing from the first text, or may be modifying words that modify the main words in the first text. Therefore, the third text modifies or improves the first text. In addition, the picture generated by the above-mentioned third text has a high degree of matching with the user's needs. In addition, since the third text includes detailed content, the generated picture is closer to the picture generated by imaging the real scene, that is, more realistic.
[0049] In this embodiment, a first text for generating a picture is received as input; a second text corresponding to the first text is determined according to a pre-constructed set of modification relationship pairs, wherein the set of modification relationship pairs includes a first modification relationship pair extracted from the text; the second text includes at least part of the content in the first text; a third text is determined according to a selection operation on the second text, wherein the second text includes the third text; an output picture corresponding to the third text is obtained by inputting the third text into a pre-trained text graph model, wherein the text graph model is used to generate a corresponding picture according to the input text. Since the above-mentioned second text is determined from the set of modification relationship pairs, the other texts in the second text except the first text have a modification relationship with the first text, that is, an accurate co-occurrence relationship, and thus the picture generated by the third text including words having an accurate co-occurrence relationship with the first text has a higher accuracy and higher authenticity than the picture generated by the first text.
[0050] In some embodiments, the pre-constructed set of modification relationship pairs also includes the co-occurrence count of the first modification relationship pair, and the above step S202 includes the following steps:
[0051] First, the first text is matched with the set of modification relationship pairs to obtain a second modification relationship pair.
[0052] The first text can be used as a matching object, the first text can be matched with a first modification relationship pair in the modification relationship pair set, and the successfully matched first modification relationship pair can be used as a second modification relationship pair. At least one second modification relationship pair can be obtained in the above manner.
[0053] Secondly, a second modification relationship pair whose co-occurrence times meet a preset condition is selected from the second modification relationship pairs as the second text.
[0054] Since the set of modification relationship pairs includes the co-occurrence counts of the first modification relationship pairs, that is, each second modification relationship pair corresponds to a co-occurrence count, the second modification relationship pairs whose co-occurrence counts meet the preset condition can be used as the second text.
[0055] In some application scenarios, the above preset condition includes that the number of co-occurrences is greater than a preset co-occurrence threshold, and the preset co-occurrence threshold can be set according to the specific application scenario. Schematically, the preset co-occurrence threshold can be, for example, 5 times, 10 times, etc.
[0056] In some application scenarios, for at least one second modification relationship pair, they can be arranged in descending order according to their corresponding co-occurrence times, and the second modification relationship pair whose arrangement sequence number is less than a preset sequence number threshold is used as the second text. The preset sequence number threshold can be set according to the specific application scenario. Schematically, the preset sequence number threshold can be 5, for example.
[0057] Since there is a modification relationship between the texts in the second modification relationship pair, the second text is determined by limiting the number of co-occurrences to meet a preset condition, so that the modification relationship pair in the second text has an accurate co-occurrence relationship.
[0058] In these embodiments, from the second modification relationship pairs in the modification relationship pair set that successfully match the first text, the second modification relationship pairs whose co-occurrence times meet the preset conditions are used as the second text. Since the first text and other words in the second text have a high number of co-occurrences and have a modification relationship, the first text and other words in the second text have a more accurate co-occurrence relationship, so that the image generated by the second text with an accurate co-occurrence relationship can improve the accuracy and authenticity of the image generated by the text input by the user.
[0059] Please refer to Figure 3 , Figure 3 is a schematic diagram of a second embodiment according to the present disclosure. Figure 3 As shown, the image generation method also includes the steps of:
[0060] S301. Obtain a fourth text.
[0061] The execution subject of constructing the modified relationship pair set can be a terminal device or a server.
[0062] The fourth text may be a text from the Internet or a text in a local text library.
[0063] Illustratively, the fourth text may include one or more entity words and modifying words that modify the entity words. The entity words may also be referred to as subject words.
[0064] The number of the fourth text mentioned above may include more than one.
[0065] The fourth text mentioned above may include texts covering different fields and written in different styles.
[0066] S302: Perform word segmentation on the fourth text and determine the part of speech of each word segmentation result.
[0067] The execution subject can use a word segmentation tool to segment the text, and then mark the part of speech for each segmentation result.
[0068] The above parts of speech include subject words, adjectives, adverbs, etc.
[0069] S303: Based on the word segmentation result carrying the part of speech, determine a first modification relationship pair from the corresponding fourth text.
[0070] At least one first modification relationship pair may be determined from the text according to the part of speech of each word segmentation result and the positional relationship between the word segmentation results.
[0071] Each first modification relationship pair includes a modification word and a modified subject word. The modification word may include a modification word used to modify the subject word (which may be regarded as a qualifier), a modification word used to modify the screen (modify multiple subject words in the screen), and the like.
[0072] S304: Generate a set of modification relationship pairs according to the fourth text and the first modification relationship pair.
[0073] The above-mentioned set of modification relationship pairs may include at least one first modification relationship pair extracted from the fourth text.
[0074] Through the above steps S301 to S304, a set of modified relationship pairs can be obtained. The set of modified relationship pairs can be used to recommend polished recommended text for the text of the image to be generated. It is understandable that the text (including type, quantity, etc.) used to generate the above set of modified relationship pairs can be added according to the application scenario to improve the accuracy of generating recommended text for the text in the above application scenario.
[0075] In some embodiments, the above step S303 includes:
[0076] The word segmentation results associated with the parts of speech are input into a pre-trained modification relationship model to obtain a first modification relationship pair in the output fourth text; wherein the modification relationship model is used to identify and output modified main words and modifying words having a modification relationship in the input text.
[0077] The above-mentioned modification relationship model can be a generative language model. The above-mentioned generative language model can be a large language (Large Language Model, LLM) model. The large language model can be an artificial intelligence model that has been pre-trained using a large amount of text data. After pre-training, the above-mentioned generative language model has the ability to recognize the structure, grammar and semantics of the language. Therefore, the pre-trained large language model has context learning and reasoning capabilities. In order to realize the recognition of modification relationship pairs in the text, the modification relationship model can also be fine-tuned using supervised learning. In the fine-tuning, a smaller training set can be used to enable the modification relationship model to have a better modification relationship pair recognition ability.
[0078] The above-mentioned subject words may include any entity-type words that can be graphically presented by computer graphics. Schematically, the subject words may be words such as sky, cloud, sea, person, classroom, etc.
[0079] The above-mentioned modifiers may include modifiers that modify a single subject word, such as any adjectives and adverbs that describe the subject, etc. Schematically, the modifiers that modify a single subject word may include words that describe the color, size, shape, etc. of the subject. The modifiers also include modifiers used to modify multiple subject words.
[0080] In order to distinguish between modifiers that modify a single subject word and modifiers that modify multiple subjects, modifiers that modify a single subject can be referred to as qualifiers, and words that modify multiple subject words or modify a screen including multiple subject words can be referred to as modifiers. In this way, modifiers can include modifiers that modify multiple subject words and qualifiers that modify each subject.
[0081] The modifying words modifying the plurality of main words may be words modifying the picture to be generated, such as hazy feeling, high definition, and the like.
[0082] Illustratively, the first modification relationship pair corresponding to a single subject word can be expressed as relation (subject=star, qualification=shine), wherein the subject word represented in the first modification relationship pair is "star", and the modification word (qualifier) is "shine".
[0083] Schematically, the first modification relationship pair corresponding to the multiple subjects in the picture can be expressed as: relation (modification = hazy feeling, subject = manor, stars, beach). Among them, the modification word in the first modification relationship pair is "hazy feeling", and the subject words in the picture are "manor", "stars" and "beach". Among them, the modification word "hazy feeling" modifies the subject words "manor", "stars" and "beach" in the picture.
[0084] In these embodiments, the first modification relationship pair in the text is determined by using a modification relationship model. On the one hand, the modification relationship pair in the text can be quickly determined. On the other hand, errors caused by manual misrecognition can be avoided, thereby ensuring the accuracy of the determined modification relationship.
[0085] In some embodiments, the above step S304 includes the following steps:
[0086] First, the number of co-occurrences of the first modification relationship pair is determined;
[0087] After obtaining the first modification relationship pairs contained in the fourth text using the modification relationship model, weighted statistics can be performed on each first modification relationship pair to determine the number of co-occurrences of each first modification relationship pair. As an illustrative example, for each modification relationship pair, the number of co-occurrences of the modification relationship pair in each fourth text can be accumulated to obtain the number of co-occurrences of the modification relationship.
[0088] Next, a modification relationship pair set including the co-occurrence counts of the first modification relationship pair is generated.
[0089] In the above set of modification relationship pairs, for each modification relationship pair, the modification relationship pair may be associated with the number of co-occurrences of the modification relationship pair.
[0090] Illustratively, the information of the modifying relationship pairs in the above modifying relationship pair set includes: main word, modifying word, and co-occurrence count. For example, "holding, sharp sword, 1000", which indicates that the main word is "sharp sword" and the modifying word is "holding": the co-occurrence count of the modifying relationship pair "holding, sharp sword" is 1000.
[0091] In these embodiments, by counting the co-occurrence times of each modification relationship pair from multiple modification relationship pairs determined from multiple texts, a modification relationship pair set including the co-occurrence times is obtained, which helps to recommend text with higher co-occurrence accuracy for the input text based on the co-occurrence times in the text graph application, that is, the accuracy of the recommended text is improved, which helps to improve the accuracy of the image generated based on the recommended text.
[0092] Figure 4 is a schematic diagram according to the third embodiment of the present disclosure, Figure 4 As shown, the modification relationship model generation method provided in this embodiment includes the following steps:
[0093] S401: construct a training set according to the acquired fifth text and the third modification relationship pairs having the modification relationship in the fifth text.
[0094] In this embodiment, the execution subject of the modified relationship model generation method may be a terminal device or a server.
[0095] The number of the fifth texts may be more than one. The fifth text may be a text obtained from the Internet or a text stored locally. The text may be a text describing different types of content. The more than one fifth texts may involve different fields.
[0096] When constructing a training set, the third modification relationship pairs can be extracted from the fifth text. For each fifth text, an input sample can be generated according to the text content in the fifth text, and an output sample corresponding to the input sample can be generated according to the third modification relationship pairs in the fifth text to obtain a training sample of the fifth text. A training sample set is formed according to the training samples corresponding to the fifth text.
[0097] In some embodiments, the above step S401 includes the following steps:
[0098] First, the fifth text is segmented and the part of speech of each segmentation result is determined.
[0099] In some application scenarios, various methods of word segmentation can be used to segment the fifth text, such as a dictionary-based word segmentation method, an understanding-based word segmentation method, and a statistical-based word segmentation method. For each word after word segmentation, stop words can be removed to obtain a word segmentation result.
[0100] For each word segmentation result, the part of speech of the word segmentation result can be determined for the word segmentation result. The part of speech includes but is not limited to: subject word, adjective, adverb, etc.
[0101] Secondly, based on the segmentation results associated with the parts of speech, a third modification relationship pair is determined from the corresponding fifth text.
[0102] The word segmentation results and their corresponding parts of speech may be associated, and then the word segmentation results associated with the parts of speech are analyzed to determine the third modification relationship pair in the fifth text.
[0103] Illustratively, a sentence component analysis method may be used to analyze the word segmentation results associated with parts of speech to determine the third modification relationship pairs having a modification relationship in the fifth text.
[0104] The modifying relationship pair includes a main word and a modifying word (which can be regarded as a limiting word) used to modify a single main word, or the modifying relationship pair includes a modifying word used to modify multiple main words or pictures and multiple main words modified by the above-mentioned modifiers.
[0105] Then, the word segmentation result associated with the part of speech of the fifth text is used as an input sample, and the third modification relationship pair is used as an output sample corresponding to the input sample to obtain a training sample.
[0106] Finally, a training sample set is constructed based on the training samples.
[0107] Therefore, each training sample includes an input sample as an input of the modified relationship model and an output sample as an output of the modified relationship model, so that the modified relationship model is fine-tuned in a supervised manner using the above training samples.
[0108] In these embodiments, by taking the word segmentation results associated with parts of speech in the fifth text as input samples and the modification relationship pairs in the fifth text as output samples to generate training samples and then constructing a training sample set, the process of preprocessing the text by the modification relationship model to be trained can be reduced, and the efficiency of fine-tuning the modification relationship model can be improved.
[0109] In some embodiments, word segmentation is performed on the fifth text, and the part of speech of each word segmentation result is determined, including:
[0110] The fifth text is input into a pre-trained sequence labeling model to obtain a word segmentation result of the fifth text and a part of speech of the word segmentation result, wherein the sequence labeling model is used to perform word segmentation on the input text and perform part of speech tagging on the word segmentation result.
[0111] The above sequence labeling model can be a deep learning model. When training the above sequence labeling model, multiple texts can be obtained, and the word segmentation results and part of speech of the word segmentation results of each text can be manually labeled. For example, a text is used as input, and the word segmentation results and part of speech tags of the word segmentation results corresponding to the text are used as output, and the initial sequence labeling model is supervised trained to obtain a trained sequence labeling model.
[0112] The trained sequence labeling model can output the word segmentation results corresponding to the fifth text and the parts of speech corresponding to each word segmentation result according to the input fifth text.
[0113] In these embodiments, each text is segmented by a sequence labeling model, and each segmentation result is tagged with a part of speech, thereby improving the efficiency of obtaining the segmentation result and part of speech information of the fifth text.
[0114] In some embodiments, the above-mentioned determining the third modification relationship pair from the corresponding fifth text based on the word segmentation result associated with the part of speech includes:
[0115] Perform dependency analysis on the word segmentation results associated with the parts of speech of the fifth text, and determine the third modification relationship pair in the fifth text according to the dependency analysis results; or analyze the word segmentation results associated with the parts of speech of the fifth text according to a preset modification relationship strategy, and determine the third modification relationship pair in the text according to the analysis results.
[0116] In some application scenarios, the word segmentation result associated with the part of speech of the fifth text may be subjected to dependency analysis, and the third modifying relationship pair in the fifth text may be determined according to the dependency analysis result.
[0117] For example, a dependency analysis is performed on the word segmentation results associated with the part of speech using a graph-based dependency analysis. Specifically, features are extracted for each word segmentation result associated with the part of speech. Feature vectors corresponding to any two word segmentation results are sent to a pre-trained classifier to calculate a dependency score. Whether any two word segmentation results in the fifth text have a modification relationship is determined based on the dependency score.
[0118] For another example, the dependency analysis based on transfer is used to determine whether any two word segmentation results of the fifth text have a modification relationship, etc. The dependency analysis based on transfer can be implemented with reference to the relevant technology, which will not be described in detail here.
[0119] In these application scenarios, using the dependency analysis method to analyze the third modification relationship pairs in the fifth text can improve the accuracy of the determined third modification relationship pairs.
[0120] In some application scenarios, a modification relationship strategy may be preset, and the segmentation results associated with the part of speech are analyzed according to the preset modification relationship strategy to obtain the third modification relationship pair in the fifth text. The modification relationship strategy includes determining whether there is a modification relationship between the segmentation results according to the part of speech and the distance between the words.
[0121] In these application scenarios, the third modification relationship pair in the fifth text is analyzed by using the above preset modification relationship strategy, so as to realize the user's personalized modification relationship pair extraction.
[0122] S402. Perform supervised fine-tuning on the pre-trained initial modification relationship model using the training set to obtain a fine-tuned modification relationship model; wherein the modification relationship model outputs a first modification relationship pair according to the input text, the first modification relationship pair is used to construct a modification relationship pair set, the modification relationship pair set is used to provide recommended text for the input text of the text-graph model, and the modification relationship model is a generative language model.
[0123] The pre-trained initial modification relationship model may be a generative language model. The generative language model may be a large language model. The pre-trained large language model has contextual learning and reasoning capabilities. In order to recognize the modification relationship in the text, the initial modification relationship model may be fine-tuned by supervised learning using the training set. In fine-tuning, a smaller training set may be used to enable the modification relationship model to have better modification relationship recognition capabilities.
[0124] Please refer to Figure 5 , shows a schematic diagram of an application scenario of the fine-tuned modification relationship model. Figure 5As shown, the user can input the following sixth text into the above-mentioned modification relationship model: "night, manor, shining stars, silver sand, half sky and half beach, transparent pebbles, red, blue, white, pink, green, colors spread into the shape of love, 8K high definition, hazy feeling". The output of the modification relationship model includes the following first modification relationship pairs: "relation(subject=manor, limitation=night)"; "relation(subject=stars, limitation=shining)"; "relation(subject=beach, limitation=silver)"; "relation(subject=pebbles, limitation=red, blue, white, pink, green)"; "relation(modification=8K high definition, subject=manor, stars, beach, pebbles)"; "relation(modification=hazy feeling, subject=manor, stars, beach, pebbles).
[0125] The output includes a plurality of first modification relationship pairs of the text. The first modification relationship pairs include modification relationship pairs that modify a single subject word, such as "relation (subject = manor, limitation = night)", and modification relationship pairs that modify multiple subject words or pictures, such as "relation (modification = hazy feeling, subject = manor, stars, beach, pebbles)".
[0126] In this embodiment, the initial modification relationship model is fine-tuned in a supervised manner using the above training set, so that the obtained modification relationship model can more accurately identify the first modification relationship pair in the input text. The accuracy of the co-occurrence relationship determined by the first modification relationship pair is improved. In the text-image scenario, the modification relationship pair set composed of the first modification relationship pair determined by the above modification relationship model is used to recommend polished text for the input text, which improves the accuracy of the recommended polished text, thereby helping to improve the accuracy of the image generated by the input text and enhance the authenticity of the generated image.
[0127] Please refer to Figure 6 , Figure 6 FIG. 4 is a schematic diagram of a fourth embodiment of the present disclosure. Figure 6 As shown, the picture generating device 600 provided in this embodiment includes:
[0128] A receiving unit 601 is used to receive a first text input for generating a picture;
[0129] A first determining unit 602 is used to determine a second text corresponding to the first text according to a pre-constructed set of modification relationship pairs, wherein the set of modification relationship pairs includes the first modification relationship pairs extracted from the text; and the second text includes at least part of the content of the first text;
[0130] A second determining unit 603 is used to determine a third text according to a selection operation on the second text, where the second text includes the third text;
[0131] The image generation unit 604 is used to obtain an output image corresponding to the third text by inputting the third text into a pre-trained text-graph model, wherein the text-graph model is used to generate a corresponding image according to the input text.
[0132] In some embodiments, the set of modifying relationship pairs also includes the co-occurrence times of each modifying relationship pair; and the first determining unit 602 includes a matching module 6021 and a selecting module 6022, wherein:
[0133] A matching module 6021, used for matching the first text with the set of modification relationship pairs to obtain a second modification relationship pair;
[0134] The selection module 6022 is used to select, from the second modification relationship pairs, a second modification relationship pair whose co-occurrence times meet a preset condition as the second text.
[0135] In some embodiments, the device 600 further includes a set determination unit 605, which includes a first acquisition module 6051, a first word segmentation module 6052, a first determination module 6053 and a generation module 6054, wherein:
[0136] A first acquisition module 6051, used for acquiring a fourth text;
[0137] A first word segmentation module 6052, configured to perform word segmentation on the fourth text and determine the part of speech of each word segmentation result;
[0138] A first determination module 6053 is used to determine a first modification relationship pair from the corresponding fourth text based on the word segmentation result associated with the part of speech;
[0139] The generating module 6054 is used to generate a set of modifying relationship pairs according to the fourth text and the first modifying relationship pairs.
[0140] In some embodiments, the first determining module 6053 is further configured to:
[0141] The word segmentation result associated with the part of speech is input into the pre-trained modification relationship model to obtain the first modification relationship pair in the output fourth text; wherein,
[0142] The modification relationship model is used to identify and output modified subject words and modifying words that have a modification relationship in the input text.
[0143] In some embodiments, the generation module 6054 is further configured to:
[0144] Determining the number of co-occurrences of the first modification relationship pair;
[0145] A modification relationship pair set including the co-occurrence counts of the first modification relationship pair is generated.
[0146] In some embodiments, a modification relationship pair includes a modifier and a modified subject term.
[0147] Please refer to Figure 7 , Figure 7 FIG. 5 is a schematic diagram of a fifth embodiment of the present disclosure. Figure 7 As shown, the modification relationship model generating device 700 provided in this embodiment includes:
[0148] A construction unit 701 is used to construct a training set according to the acquired fifth text and the third modification relationship pair having the modification relationship in the fifth text;
[0149] The training unit 702 is used to perform supervised fine-tuning on the pre-trained initial modification relationship model using the training set to obtain a fine-tuned modification relationship model; wherein,
[0150] The modification relationship model outputs a first modification relationship pair according to the input text. The first modification relationship pair is used to construct a modification relationship pair set. The modification relationship pair set is used to provide recommended text for the input text of the text graph model. The modification relationship model is a generative language model.
[0151] In some embodiments, the construction unit 701 includes a second word segmentation module 7011, a second determination module 7012, a third determination module 7013 and a construction module 7014, wherein:
[0152] The second word segmentation module 7011 is used to perform word segmentation on the fifth text and determine the part of speech of each word segmentation result;
[0153] A second determination module 7012 is used to determine a third modification relationship pair from the corresponding fifth text based on the word segmentation result associated with the part of speech;
[0154] A third determination module 7013 is used to use the word segmentation result of the fifth text marked with the part of speech as an input sample and the third modification relationship pair as an output sample corresponding to the input sample to obtain a training sample;
[0155] The construction module 7014 is used to construct a training sample set according to the training samples.
[0156] In some embodiments, the second word segmentation module 7011 is further used to:
[0157] The fifth text is input into a pre-trained sequence labeling model to obtain a word segmentation result of the fifth text and a part of speech of the word segmentation result, wherein the sequence labeling model is used to perform word segmentation on the input text and perform part of speech tagging on the word segmentation result.
[0158] In some embodiments, the second determining module 7012 is further configured to:
[0159] Performing dependency analysis on the word segmentation results associated with the parts of speech, and determining the third modification relationship pair in the fifth text according to the dependency analysis results; or
[0160] The word segmentation results associated with the parts of speech are analyzed according to a preset modification relationship strategy, and a third modification relationship pair in the text is determined according to the analysis results.
[0161] Figure 8 is a schematic diagram according to a sixth embodiment of the present disclosure, Figure 8 As shown, the electronic device 800 in this embodiment may include: a processor 801 and a memory 802 .
[0162] The memory 802 is used to store programs; the memory 802 may include volatile memory (English: volatile memory), such as random-access memory (English: random-access memory, abbreviated: RAM), such as static random-access memory (English: static random-access memory, abbreviated: SRAM), double data rate synchronous dynamic random access memory (English: Double Data Rate Synchronous Dynamic Random Access Memory, abbreviated: DDR SDRAM), etc.; the memory may also include non-volatile memory (English: non-volatile memory), such as flash memory (English: flash memory). The memory 802 is used to store computer programs (such as applications, functional modules, etc. that implement the above method), computer instructions, etc., and the above computer programs, computer instructions, etc. can be partitioned and stored in one or more memories 802. And the above computer programs, computer instructions, data, etc. can be called by the processor 801.
[0163] The above-mentioned computer programs, computer instructions, etc. may be stored in partitions in one or more memories 802 . And the above-mentioned computer programs, computer instructions, etc. may be called by the processor 801 .
[0164] The processor 801 is used to execute the computer program stored in the memory 802 to implement each step of the method involved in the above embodiment.
[0165] For details, please refer to the relevant description in the previous method embodiment.
[0166] The processor 801 and the memory 802 may be independent structures or integrated structures. When the processor 801 and the memory 802 are independent structures, the memory 802 and the processor 801 may be coupled and connected via a bus 803 .
[0167] The electronic device of this embodiment can execute the technical solution in the above method, and its specific implementation process and technical principle are the same, which will not be repeated here.
[0168] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0169] According to an embodiment of the present disclosure, the present disclosure further provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute a solution provided by any of the above embodiments.
[0170] According to an embodiment of the present disclosure, the present disclosure also provides a computer program product, which includes: a computer program, the computer program is stored in a readable storage medium, at least one processor of an electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device executes the solution provided by any of the above embodiments.
[0171] Fig. 9 A schematic block diagram of an example electronic device that can be used to implement an embodiment of the present disclosure is shown. Among them, the electronic device 900 can be a terminal device or a server. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0172] like Fig. 9 As shown, the device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0173] A number of components in the device 900 are connected to the I / O interface 905, including: an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a disk, an optical disk, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the device 900 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0174] The computing unit 901 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 901 performs the various methods and processes described above, such as the generation operation process of the electronic case report. For example, in some embodiments, the generation operation process of the electronic case report may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the generation operation process of the electronic case report described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to perform the electronic case report generation operation process in any other appropriate manner (eg, by means of firmware).
[0175] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0176] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0177] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0178] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0179] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0180] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0181] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0182] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for generating an image, comprising: Receive a first text input for generating a picture; Determine at least one second text corresponding to the first text according to a pre-constructed set of modification relationship pairs, wherein the set of modification relationship pairs includes a first modification relationship pair extracted from the text; and the second text includes at least part of the content of the first text; Determining a third text according to a selection operation on the at least one second text displayed on the display interface, wherein the second text includes the third text, the third text includes at least part of the first text, and other texts that have a modifying relationship with the first text; By inputting the third text into a pre-trained text-graph model, an output image corresponding to the third text is obtained, wherein the text-graph model is used to generate a corresponding image according to the input text.
2. The method according to claim 1, characterized in that The set of modification relationship pairs also includes the number of co-occurrences of the first modification relationship pairs; as well as The step of determining at least one second text corresponding to the first text according to the pre-constructed set of modification relationship pairs includes: Matching the first text with the set of modification relationship pairs to obtain a second modification relationship pair; A second modification relationship pair whose co-occurrence times meet a preset condition is selected from the second modification relationship pairs as the at least one second text.
3. The method according to claim 1, characterized in that The method further comprises: Get the fourth text; Performing word segmentation on the fourth text and determining the part of speech of each word segmentation result; Based on the segmentation result associated with the part of speech, determining the first modification relationship pair from the corresponding fourth text; The modification relationship pair set is generated according to the fourth text and the first modification relationship pair.
4. The method according to claim 3, characterized in that The determining the first modification relationship pair from the corresponding fourth text based on the word segmentation result associated with the part of speech includes: The word segmentation result associated with the part of speech is input into a pre-trained modification relationship model to obtain the first modification relationship pair in the output fourth text; wherein, The modification relationship model is used to identify and output modified subject words and modifying words having a modification relationship in the input text.
5. The method according to claim 3, characterized in that: The step of generating the set of modification relationship pairs according to the fourth text and the first modification relationship pairs includes: Determining the number of co-occurrences of the first modification relationship pair; The modification relationship pair set including the co-occurrence counts of the first modification relationship pairs is generated.
6. The method according to any one of claims 1 to 5, characterized in that: The first modification relationship pair includes a modification word and a modified main word.
7. A method for generating a modification relationship model, the method comprising: constructing a training set according to the acquired fifth text and the third modification relationship pairs having the modification relationship in the fifth text; The pre-trained initial modification relationship model is fine-tuned in a supervised manner using the training set to obtain a fine-tuned modification relationship model; wherein, The modification relationship model outputs a first modification relationship pair based on the input text, the first modification relationship pair is used to construct a modification relationship pair set, the modification relationship pair set is used to provide recommended text for the input text of the text-based graph model, the modification relationship model is a generative language model, and the modification relationship model is used in the image generation method as described in any one of claims 1-6.
8. The method according to claim 7, characterized in that The step of constructing a training set based on the acquired fifth text and the third modification relationship pair having a modification relationship in the fifth text comprises: Performing word segmentation on the fifth text and determining the part of speech of each word segmentation result; Based on the word segmentation result associated with the part of speech, determining the third modification relationship pair from the corresponding fifth text; Using the word segmentation result of the fifth text marked with parts of speech as an input sample, and using the third modification relationship pair as an output sample corresponding to the input sample, to obtain a training sample; The training sample set is constructed according to the training samples.
9. The method according to claim 8, characterized in that The step of performing word segmentation on the fifth text and determining the part of speech of each word segmentation result includes: The fifth text is input into a pre-trained sequence labeling model to obtain a word segmentation result of the fifth text and a part of speech of the word segmentation result, wherein the sequence labeling model is used to perform word segmentation on the input text and to perform part of speech tagging on the word segmentation result.
10. The method according to claim 8, characterized in that The determining the third modification relationship pair from the corresponding fifth text based on the word segmentation result associated with the part of speech includes: Performing dependency analysis on the word segmentation results associated with the parts of speech, and determining the third modification relationship pair in the fifth text according to the dependency analysis results; or The word segmentation results associated with the parts of speech are analyzed according to a preset modification relationship strategy, and the third modification relationship pair in the text is determined according to the analysis results.
11. A picture generating device, comprising: A receiving unit, configured to receive a first text input for generating a picture; A first determining unit is used to determine at least one second text corresponding to the first text according to a pre-constructed set of modification relationship pairs, wherein the set of modification relationship pairs includes a first modification relationship pair extracted from the text; and the second text includes at least part of the content of the first text; a second determining unit, configured to determine a third text according to a selection operation on the at least one second text displayed on the display interface, wherein the second text includes the third text, the third text includes at least part of the first text, and other texts having a modifying relationship with the first text; The image generation unit is used to obtain an output image corresponding to the third text by inputting the third text into a pre-trained text-graph model, wherein the text-graph model is used to generate a corresponding image according to the input text.
12. The device according to claim 11, characterized in that The set of modifying relationship pairs also includes the co-occurrence count of the first modifying relationship pair; and The first determination unit includes a matching module and a selection module, wherein: A matching module, used for matching the first text with the set of modification relationship pairs to obtain a second modification relationship pair; A selection module is used to select a second modification relationship pair whose co-occurrence times meet a preset condition from the second modification relationship pairs as the at least one second text.
13. The device according to claim 12, characterized in that The device further includes a set determination unit, which includes a first acquisition module, a first determination module, a second determination module and a generation module, wherein: A first acquisition module, used for acquiring a fourth text; A first word segmentation module, used for performing word segmentation on the fourth text and determining the part of speech of each word segmentation result; A first determination module, configured to determine the first modification relationship pair from the corresponding fourth text based on the word segmentation result associated with the part of speech; A generating module is used to generate the modifying relationship pair set according to the fourth text and the first modifying relationship pair.
14. The device according to claim 13, characterized in that The first determining module is further used for: The word segmentation result associated with the part of speech is input into a pre-trained modification relationship model to obtain the first modification relationship pair in the output fourth text; wherein, The modification relationship model is used to identify and output modified subject words and modifying words having a modification relationship in an input text.
15. The device according to claim 13, characterized in that The generation module is also used for: Determining the number of co-occurrences of the first modification relationship pair; The modification relationship pair set including the co-occurrence counts of the first modification relationship pairs is generated.
16. The device according to any one of claims 11 to 15, characterized in that A modification relationship pair includes a modifying word and a modified main word.
17. A modification relationship model generating device, comprising: A construction unit, configured to construct a training set according to the acquired fifth text and the third modification relationship pairs having the modification relationship in the fifth text; A training unit is used to perform supervised fine-tuning on the pre-trained initial modification relationship model using the training set to obtain a fine-tuned modification relationship model; wherein, The modification relationship model outputs a first modification relationship pair based on the input text, the first modification relationship pair is used to construct a modification relationship pair set, the modification relationship pair set is used to provide recommended text for the input text of the text-based graph model, the modification relationship model is a generative language model, and the modification relationship model is used in the image generation method as described in any one of claims 1-6.
18. The device according to claim 17, characterized in that The construction unit includes a second word segmentation module, a second determination module, a third determination module and a construction module, wherein: The second word segmentation module is used to perform word segmentation on the fifth text and determine the part of speech of each word segmentation result; The second determination module is used to determine the third modification relationship pair from the corresponding fifth text based on the word segmentation result associated with the part of speech; The third determination module is used to use the word segmentation result of the fifth text marked with part of speech as an input sample, and use the third modification relationship pair as an output sample corresponding to the input sample to obtain a training sample; The construction module is used to construct the training sample set according to the training samples.
19. The device according to claim 18, characterized in that The second word segmentation module is also used for: The fifth text is input into a pre-trained sequence labeling model to obtain a word segmentation result of the fifth text and a part of speech of the word segmentation result, wherein the sequence labeling model is used to perform word segmentation on the input text and to perform part of speech tagging on the word segmentation result.
20. The device according to claim 18, characterized in that The second determining module is further used for: Performing dependency analysis on the word segmentation results associated with the parts of speech, and determining the third modification relationship pair in the fifth text according to the dependency analysis results; or The word segmentation results associated with the parts of speech are analyzed according to a preset modification relationship strategy, and the third modification relationship pair in the text is determined according to the analysis results.
21. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 10.
22. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-10.
23. A computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Image generation method and device, electronic equipment and storage medium
CN116797684A