CN117272987A - Image generation method and device, electronic equipment and storage medium - Google Patents

Image generation method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN117272987A
CN117272987A CN202311154684.6A CN202311154684A CN117272987A CN 117272987 A CN117272987 A CN 117272987A CN 202311154684 A CN202311154684 A CN 202311154684A CN 117272987 A CN117272987 A CN 117272987A
Authority
CN
China
Prior art keywords
keyword
keywords
word
prompting
words
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311154684.6A
Other languages
Chinese (zh)
Inventor
吴林斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bright Jupiter Private Ltd
Original Assignee
Bright Jupiter Private Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Bright Jupiter Private Ltd filed Critical Bright Jupiter Private Ltd
Priority to CN202311154684.6A priority Critical patent/CN117272987A/en
Publication of CN117272987A publication Critical patent/CN117272987A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/284Lexical analysis, e.g. tokenisation or collocates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/237Lexical tools
    • G06F40/242Dictionaries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides an image generation method, an image generation device, electronic equipment and a storage medium, and relates to the technical field of artificial intelligence, wherein the method comprises the following steps: receiving a prompt word input by a user; determining and displaying alternative keywords corresponding to the prompting words, wherein the alternative keywords are sub-keywords in the association relation of the prompting words serving as father keywords in a keyword library; determining a target keyword according to the received first selection instruction, updating the prompting word according to the target keyword and the prompting word, and repeatedly executing the steps of determining and displaying the candidate keyword corresponding to the prompting word until a picture generation instruction input by a user is received; and generating a target image according to the updated prompt word. By applying the scheme provided by the embodiment of the invention, the accuracy of the image can be improved.

Description

Image generation method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of artificial intelligence, and in particular, to an image generating method, an image generating device, an electronic device, and a storage medium.
Background
With the continuous development of artificial intelligence, the art of AI (artificial intelligence ) is continuously developed, and a user can use AI drawing software to perform the art of the art, specifically, the AI drawing software generates an image converted from a prompt word (prompt) according to the prompt word (prompt) input by the user.
However, for users who have no much experience in use, it is difficult to accurately describe the expected image frame, so that the input prompt word is often inaccurate, and the accuracy of the image generated based on the input prompt word is low.
Disclosure of Invention
An embodiment of the invention aims to provide an image generation method, an image generation device, electronic equipment and a storage medium, so as to improve the accuracy of an image. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides an image generating method, applied to an electronic device, where a keyword library is stored in the electronic device, each keyword in the keyword library is associated based on an association relationship between keywords, each keyword is a vocabulary that describes an image and is selected in advance, and the association relationship includes a parent keyword that characterizes a description topic and a child keyword that characterizes the description topic, and the method includes:
receiving a prompt word input by a user;
determining and displaying alternative keywords corresponding to the prompt words; wherein the candidate keywords are sub-keywords in the association relation of the keyword library by taking the prompting words as parent keywords;
Determining a target keyword according to the received first selection instruction, updating the prompting word according to the target keyword and the prompting word, and repeatedly executing the steps of determining and displaying the candidate keyword corresponding to the prompting word until receiving the picture generation instruction input by the user;
and generating a target image according to the updated prompt word.
In one embodiment of the invention, the association between keywords is established by:
determining a target category of a keyword to be associated and a preset subcategory corresponding to the target category, wherein the keyword to be associated is any keyword in the keyword library, the target category is a category to which the keyword to be associated belongs, and the vocabulary belonging to the preset subcategory is used for describing the vocabulary belonging to the target category;
and under the condition that the keywords to be detected belong to the preset sub-category, taking the keywords to be associated as father keywords, taking the keywords to be detected as sub-keywords, and establishing the association relation between the keywords to be associated and the keywords to be detected, wherein the keywords to be detected are keywords except the keywords to be associated in the keyword library.
In one embodiment of the present invention, the generating the target image according to the updated prompt word includes:
sorting the updated prompting words to generate sorted word groups, wherein prompting words positioned behind the word groups in adjacent prompting words in the sorted word groups are sub-keywords of the prompting words positioned in front of the word groups;
and generating a target image based on the ordered phrase.
In one embodiment of the present invention, each keyword in the keyword library includes a parameter for performing image processing on the content represented by the keyword, and the method further includes:
determining parameters contained in the keywords which are the same as the prompting words in the keyword library;
generating and displaying a parameter configuration interface of the parameter;
based on a configuration instruction input by the user on the parameter configuration interface, generating parameter information containing the parameters and parameter values of the parameters indicated by the configuration instruction, wherein the parameter information is used as the parameter information of the prompt word;
generating the target image according to the updated prompt word comprises the following steps:
and generating a target image according to the updated prompt words and the parameter information of each prompt word.
In one embodiment of the present invention, each keyword in the keyword library performs tree association based on an association relationship between keywords, a parent keyword representing a description topic is included in a root node for the description topic in a tree, and a child keyword representing the description topic in the association relationship is included in a child node for the description topic in the tree.
In one embodiment of the invention, the method further comprises: after the candidate keywords corresponding to the prompt words are determined and displayed, the method further comprises the following steps: and under the condition that the prompting word input by the user is received, determining the input prompting word as a new prompting word input by the user, and repeatedly executing the steps of determining and displaying the alternative keywords corresponding to the prompting word.
In one embodiment of the present invention, the determining and displaying the candidate keywords corresponding to the prompting word includes:
and determining and displaying the alternative keywords corresponding to the prompt words and a preview effect diagram, wherein the preview effect diagram is an effect diagram corresponding to a phrase formed by the updated prompt words and the alternative keywords.
In one embodiment of the present invention, the generating the target image according to the updated prompt word includes:
judging whether the number of the updated prompting words reaches the preset number or not;
if the number of the updated prompting words reaches the preset number, generating a target image based on the updated prompting words;
if the number of the updated prompting words does not reach the preset number, determining the last prompting word in the updated prompting words as a new prompting word, and repeatedly executing the steps of determining and displaying the alternative keywords corresponding to the prompting words.
In a second aspect, an embodiment of the present invention provides an image generating apparatus, applied to an electronic device, where a keyword library is stored in the electronic device, each keyword in the keyword library is associated based on an association relationship between keywords, each keyword is a vocabulary that describes an image and is selected in advance, and the association relationship includes a parent keyword that characterizes a description topic and a child keyword that characterizes the description topic, where the apparatus includes:
the prompt word receiving module is used for receiving the prompt word input by the user;
the keyword display module is used for determining and displaying alternative keywords corresponding to the prompting words; wherein the candidate keywords are sub-keywords in the association relation of the keyword library by taking the prompting words as parent keywords;
the instruction receiving module is used for determining a target keyword according to the received first selection instruction, updating the prompting word according to the target keyword and the prompting word, and repeatedly executing the steps of determining and displaying the candidate keyword corresponding to the prompting word until receiving the picture generation instruction input by the user;
and the image generation module is used for generating a target image according to the updated prompt word.
In one embodiment of the present invention, the apparatus further includes a relationship establishing module, configured to establish an association relationship between keywords by:
determining a target category of a keyword to be associated and a preset subcategory corresponding to the target category, wherein the keyword to be associated is any keyword in the keyword library, the target category is a category to which the keyword to be associated belongs, and the vocabulary belonging to the preset subcategory is used for describing the vocabulary belonging to the target category;
and under the condition that the keywords to be detected belong to the preset sub-category, taking the keywords to be associated as father keywords, taking the keywords to be detected as sub-keywords, and establishing the association relation between the keywords to be associated and the keywords to be detected, wherein the keywords to be detected are keywords except the keywords to be associated in the keyword library.
In one embodiment of the present invention, the image generating module is specifically configured to:
sorting the updated prompting words to generate sorted word groups, wherein prompting words positioned behind the word groups in adjacent prompting words in the sorted word groups are sub-keywords of the prompting words positioned in front of the word groups;
And generating a target image based on the ordered phrase.
In one embodiment of the present invention, each keyword in the keyword library includes a parameter for performing image processing on content represented by the keyword, and the apparatus further includes:
the parameter determining module is used for determining parameters contained in the keywords which are the same as the prompting words in the keyword library; generating and displaying a parameter configuration interface of the parameter; based on a configuration instruction input by the user on the parameter configuration interface, generating parameter information containing the parameters and parameter values of the parameters indicated by the configuration instruction, wherein the parameter information is used as the parameter information of the prompt word;
the image generation module is specifically configured to:
and generating a target image according to the updated prompt words and the parameter information of each prompt word.
In one embodiment of the present invention, each keyword in the keyword library performs tree association based on an association relationship between keywords, a parent keyword representing a description topic is included in a root node for the description topic in a tree, and a child keyword representing the description topic in the association relationship is included in a child node for the description topic in the tree.
In one embodiment of the invention, the apparatus further comprises:
and the prompt word determining module is used for determining the input prompt word as a new prompt word input by the user under the condition that the prompt word input by the user is received after the candidate keywords corresponding to the prompt word are determined and displayed, and repeatedly executing the steps of determining and displaying the candidate keywords corresponding to the prompt word.
In one embodiment of the present invention, the keyword display module is specifically configured to:
and determining and displaying the alternative keywords corresponding to the prompt words and a preview effect diagram, wherein the preview effect diagram is an effect diagram corresponding to a phrase formed by the updated prompt words and the alternative keywords.
In one embodiment of the present invention, the image generating module is specifically configured to:
judging whether the number of the updated prompting words reaches the preset number or not;
if the number of the updated prompting words reaches the preset number, generating a target image based on the updated prompting words;
if the number of the updated prompting words does not reach the preset number, determining the last prompting word in the updated prompting words as a new prompting word, and repeatedly executing the steps of determining and displaying the alternative keywords corresponding to the prompting words.
In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
and a processor for implementing the steps of the image generation method according to any one of the first aspect when executing the program stored in the memory.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having stored therein a computer program which, when executed by a processor, implements the image generation method of any one of the first aspects described above.
In a fifth aspect, embodiments of the present invention also provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform the image generation method of any of the first aspects described above.
The embodiment of the invention has the beneficial effects that:
according to the image generation method provided by the embodiment of the invention, after the prompting word input by the user is received, the user can carry out the next description according to the displayed prompting word by determining and displaying the corresponding alternative keyword of the prompting word, and a targeted prompting is provided for the prompting word input by the user.
And after each prompting word is input by a user, the alternative keywords corresponding to the prompting word are displayed to prompt the user to input the prompting word next, so that the prompting word inputting process is simpler, more convenient and easier to operate, and the threshold of generating images by the user is reduced.
Of course, it is not necessary for any one product or method of practicing the invention to achieve all of the advantages set forth above at the same time.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the invention, and other embodiments may be obtained according to these drawings to those skilled in the art.
Fig. 1-1 is a schematic flow chart of a first image generating method according to an embodiment of the present invention;
fig. 1-2 are schematic diagrams for establishing association relationships according to embodiments of the present invention;
fig. 2-1 is a schematic flow chart of a second image generating method according to an embodiment of the present invention;
fig. 2-2 are schematic diagrams showing alternative keywords and preview effect diagrams according to an embodiment of the present invention;
Fig. 3 is a flowchart of a third image generating method according to an embodiment of the present invention;
fig. 4 is a flowchart of a fourth image generating method according to an embodiment of the present invention;
fig. 5 is a flowchart of a fifth image generating method according to an embodiment of the present invention;
fig. 6 is a flowchart of a sixth image generating method according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of associating keywords in a tree structure according to an embodiment of the present invention;
fig. 8 is a flowchart of a seventh image generating method according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of an image generating apparatus according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by the person skilled in the art based on the present invention are included in the scope of protection of the present invention.
In order to improve the accuracy of an image, embodiments of the present invention provide an image generating method, an image generating device, an electronic device, and a storage medium, which are specifically described below.
In a first aspect, an embodiment of the present invention provides an image generating method, applied to an electronic device, where a keyword library is stored in the electronic device, each keyword in the keyword library is associated based on an association relationship between keywords, where each keyword is a word that describes an image and is selected in advance, and the association relationship includes a parent keyword that characterizes a description topic and a child keyword that characterizes the description topic.
The selection of the vocabulary can be realized by performing tuning test on a large number of input vocabularies on AI drawing software, and keywords which are specialized and standard in expression are determined. Specifically, a sample image can be obtained first, a prompt word which is input by an operator in AI drawing software and used for describing the sample image is received, an image which is output by the AI drawing software based on the input prompt word is obtained, the difference between the output image and the sample image is calculated, and the input prompt word is used as a keyword in a keyword library under the condition that the difference is smaller than a preset difference. The selection process described above may be implemented by a related training model or selection model. The AI drawing software can refer to software capable of carrying out text drawing in the related technology, and can be determined according to specific requirements.
In one example, the prompt words entered to describe the emotional state of the person in the sample image are: and (3) happy, pleasant and happy, calculating that the difference value between the output image and the sample image is smaller than the preset difference value under the condition that the prompt word is pleasant, and determining that the prompt word is pleasant and accords with the specification if the prompt word is accurate and the prompt word is agreeable, and storing the prompt word into a keyword library.
In one example, the keywords contained in the keyword library are determined to be: exposed, smile, cavalier dog in armor (armor rider dogs), wear armor helmet (Dai Kuijia helmets), happy, joy, jewell eyes, sparkling fur, stream, rainbow, castle, quat, historical, warname, shining stars, angel, meteor, mighty, powerful, handname, color, bright color, wars of the roses (rose wars) and the like. In addition, the text types of the keywords are not limited, for example, the text types can be Chinese, english, french and the like, and can be determined according to actual requirements.
After determining the canonical and accurate keywords, the association may be based on the association relationship between the keywords. Specifically, after a keyword is determined, the keyword is used as a description subject and defined as a parent keyword, and other keywords for describing the keyword are defined as sub-keywords of the keyword. Specifically, the association relationship between the keywords may be specifically referred to association rules in the related art.
In one example (a-1), the keywords included in the keyword library are determined to be: animals, cats, dogs, flowers, grasses, white, black, running, lying flat, beach, street, coconut tree, mango tree. Under the condition that the animal is determined to be the descriptive subject, determining that the animal is a father keyword in the association relationship, and determining the association relationship between the animal and the cat and the association relationship between the animal and the dog because the cat and the dog belong to species in the animal category; in the association of animals and cats, determining that the cats are sub-keywords of the father keyword of the animals; in the association of animals with dogs, it is possible to determine that dogs are children of the parent term of animals.
Under the condition that the dog is determined to be a description subject, the dog is determined to be a father keyword, white and black in the keyword library can be the fur of the dog, running and lying in the keyword library can be actions of the dog, and beach and streets in the keyword library can be scenes where the dog is located, so that the association between the dog and the white, the association between the dog and the black, the association between the dog and the running, the association between the dog and the lying flat, the association between the dog and the beach and the association between the dog and the streets can be determined. In the association relation between the dogs and the white, determining the white as a sub-keyword of the dogs; in the association relationship between the dog and the black, determining that the black is a sub-keyword of the dog; in the association relation between the dog and the running, determining a sub-keyword which runs as a parent keyword of the dog; in the association of the dog and lying, determining lying as a child keyword of the parent keyword of the dog; in the association relationship between the dogs and the sand beach, the sand beach can be determined to be a sub-keyword of the dogs; in the association of dogs with streets, streets may be determined to be sub-keywords for dogs.
Under the condition that the sand beach is determined to be the descriptive theme, the sand beach is determined to be a father keyword, flowers, grasses, coconut trees and mango trees in the keyword library can be the types of plants existing on the sand beach, so that the association relationship between the sand beach and the flowers, the association relationship between the sand beach and the grasses, the association relationship between the sand beach and the coconut trees and the association relationship between the sand beach and the mango trees can be determined. In the association relation between the beach and the coconut tree, the coconut tree can be determined to be a sub-keyword of the beach; in the association relation between the beach and the mango tree, the mango tree can be determined to be a sub-keyword of the beach; in the association relation between the sand beach and the flowers, determining the flowers as the sub-keywords of the father keyword of the sand beach; in the association of beach and grass, grass may be determined to be a child of the parent of beach.
Under the condition that the coconut tree is determined to be the description subject, the coconut tree is determined to be the father keyword, and the dogs and cats in the keyword library can be animals existing on the coconut tree, so that the association relationship between the coconut tree and the dogs and the association relationship between the coconut tree and the cats can be determined. In the association relationship between the coconut tree and the dog, determining the dog as a sub-keyword of the coconut tree; in the association relationship between the coconut tree and the cat, the cat can be determined to be a sub-keyword of the coconut tree.
Under the condition that the mango tree is determined to be the description subject, the mango tree is determined to be the father keyword, and dogs and cats in the keyword library can be animals existing on the mango tree, so that the association relationship between the mango tree and the dogs and the association relationship between the mango tree and the cats can be determined. In the association relationship between the mango tree and the dog, the dog can be determined to be a sub-keyword of the mango tree; in the association relationship between the mango tree and the cat, the cat can be determined to be a sub-keyword of the mango tree.
For one keyword, there may be a plurality of association relations, and among the plurality of association relations for the keyword, the keyword may be either a parent keyword or a child keyword. The specific situation is determined according to the association relation of the keywords,
corresponding to the example (a-1), for the dog, in the association between the animal and the dog, the dog is a word describing the animal, which is a sub-keyword, and the dog, in the association between the dog and the beach, which is a scene where the dog is located, the dog is a subject to be described, which is a parent keyword. For the key word of the beach, in the association relation between the dogs and the beach, the beach is the description of the scene in which the dogs are located and is a sub-key word, while in the association relation between the beach and the coconut tree, the coconut tree is the kind of tree existing on the beach, and the beach is the described subject and is a father key word.
Referring to fig. 1-1, fig. 1-1 is a flowchart of a first image generating method according to an embodiment of the present invention, where the method may include the following steps S101-S105.
S101, receiving a prompt word input by a user.
The prompting words input by the user are words for describing the expected image picture by the user.
In one example (a-2), the image frame envisioned by the user is a frame of a dog on a beach where coconut trees are planted, the prompting word input by the user is a dog, and the received prompting word is a dog.
In addition, in the process of inputting the prompt word by the user, the user can be prompted with the prompt word possibly to be input by the user according to the content input by the user. In one example, the first two letters of a word are entered by the user, and then the keyword with the two letters as the initial letters is correspondingly displayed.
S102, determining and displaying alternative keywords corresponding to the prompt words.
The candidate keywords are sub-keywords in the association relation of the keyword library with the prompting word as the parent keyword.
Specifically, the association relation of the input prompting word in the keyword library can be determined first, then the association relation taking the input prompting word as the father keyword is found out from the determined association relation to be used as the target association relation, and the sub-keywords in the target association relation are used as the candidate keywords.
In one example (a-3), assuming that the keyword library is the keyword library in the above example (a-1), it can be determined that the association relationship including the dog is: the relationship between animals and dogs, the relationship between dogs and white, the relationship between dogs and black, the relationship between dogs and running, the relationship between dogs and lying flat, the relationship between dogs and beach, and the relationship between dogs and street. Wherein, the association relation of the dog as the father keyword is as follows: the association of the dog with white, the association of the dog with black, the association of the dog with running, the association of the dog with lying, the association of the dog with beach and the association of the dog with streets are used as target association, and the sub-keywords in the target association are determined as follows: white, black, running, lying flat, beach, street, white, black, running, lying flat, beach, street may be displayed to the user as alternative keywords for the dog.
The number of the displayed candidate keywords can be one or more, and the candidate keywords are determined according to the association condition among the keywords in the keyword library. After the alternative keywords are displayed, the user is allowed to determine the prompt word to be input next based on the displayed alternative keywords.
If the keyword library does not detect the user-entered word, the user may be prompted for an input error so that the user may reenter the word present in the keyword library.
In addition, if the number of the input prompting words is multiple, the candidate keywords of the last input prompting word in the prompting words are determined and displayed.
S103, determining target keywords according to the received first selection instruction, and updating prompt words according to the target keywords and the prompt words.
Specifically, the first selection instruction is a selection instruction which is input by a user and selects one keyword from the displayed candidate keywords. Under the condition that a first selection instruction input by a user is received, taking the keyword selected by the first selection instruction as a target keyword, taking the target keyword as a new prompt word input by the user again, and taking the previously input prompt word and the new prompt word input at the time as updated prompt words.
In one example (a-4), assuming that in the case of example (a-3), the first selection instruction input by the user is received and the first selection instruction indicates that the beach is the target keyword, the beach is determined to be the new prompt word input by the user, and the dog and the beach are updated prompt words.
After the above step S103 is performed, step S104 may be performed.
S104, judging whether a picture generation instruction input by a user is received.
In the case where the picture generation instruction is not received, the above-described step S102 is repeatedly executed.
In one example (a-5), it is assumed that in the above example (a-4), after the beach is determined as a new hint word input by the user, the user has not yet completed the description of the expected image frame and has not input the picture generation instruction, and therefore has not received the picture generation instruction, in which case, the candidate keywords corresponding to the beach are determined and displayed, specifically, the sub-keywords flower, grass, coconut tree, and mango tree in the two association relations of beach and flower, beach and grass, beach and coconut tree with the beach as the parent keywords are displayed.
In one example (a-6), assuming that in the above example (a-5), after four candidate keywords of flowers, grasses, coconut tree and mango tree corresponding to beach are determined and displayed, a first selection instruction input by the user is received, and the selected target keyword is a coconut tree, the coconut tree is determined as a new hint word input by the user.
In the case of receiving the picture generation instruction, step S105 is performed.
S105, generating a target image according to the updated prompt words.
Specifically, a target image containing the updated content of the cue word characterization is generated.
In one example (a-7), assuming that in the above example (a-6), after the coconut tree is determined to be a new hint word input by the user, a picture generation instruction input by the user is received, a target image including the contents of the dog, beach, and coconut tree is generated based on the dog, beach, and coconut tree.
In the embodiment of the invention, after the prompting word input by the user is received, the user can perform the next description according to the displayed alternative keyword by determining and displaying the alternative keyword corresponding to the prompting word, and a targeted prompting is provided for the prompting word input by the user, because the displayed alternative keyword is a word which is selected in advance and is used for describing the image, and the selected word is more professional and normative than the word input by the inexperienced user, the user can input the prompting word with more professional and normative according to the prompting alternative keyword, and because the prompting alternative keyword is a sub-keyword in the association relation of the prompting word as a father keyword in the keyword library, the alternative keyword is used for describing the prompting word, thereby guiding the user to perform more specific description on the scene in the prediction, prompting the user to input more prompting words, further generating the image based on the updated more professional and specific prompting word, and improving the accuracy of the generated target image.
In addition, if the user wants to generate an image which accords with the expectation, the user needs to input the prompting words for a plurality of times to try and miss, in the embodiment of the invention, after each prompting word is input by the user, the user can display the alternative keywords corresponding to the prompting words to prompt the user to input the prompting words next, and the alternative keywords are the selected words for describing the prompting words, so that the input prompting words are more accurate and reliable, the try and miss times of the user can be greatly reduced, and the plotting rate is improved. And moreover, the user can be guided to input the prompt word by displaying the alternative keywords, so that the process of inputting the prompt word is simpler, more convenient and easier to operate, and the threshold of generating an image by the user is reduced.
In an embodiment of the present invention, referring to fig. 1-2, fig. 1-2 are schematic diagrams for establishing association relationships provided in the embodiment of the present invention, and association relationships between keywords may be established through the following steps S201-S202.
S201, determining a target category of the keyword to be associated and a preset subcategory corresponding to the target category.
The keywords to be associated are any keywords in a keyword library, the target category is the category to which the keywords to be associated belong, and the vocabulary belonging to the preset sub-category is used for describing the vocabulary belonging to the target category.
Specifically, the target category and the preset subcategory corresponding to the target category may be preset according to actual requirements, and in particular, refer to related technologies. Further, the category to which each keyword in the keyword library belongs may be set in advance.
In one example (b-1), the predetermined sub-category corresponding to the target category for dogs includes: the dog breed, dog body shape, dog fur color. The keywords contained in the keyword library are determined as follows: pet dogs, bomei, kokyi, large dogs, small dogs, short hairs, long hairs, black.
In one example (b-2), corresponding to the above example (b-1), if it is determined that the pet dog is a keyword to be associated, it may be determined that the target class corresponding to the pet dog is a dog, and the preset subcategories corresponding to the dog are: the dog breed, dog body shape, dog fur color.
S202, under the condition that the keywords to be detected belong to preset subcategories, the keywords to be associated are taken as father keywords, the keywords to be detected are taken as subcategories, and the association relation between the keywords to be associated and the keywords to be detected is established.
The keywords to be detected are keywords except the keywords to be associated in the keyword library.
Specifically, whether each keyword to be detected belongs to a preset subcategory is determined, and if the keyword to be detected belongs to the preset subcategory, the association relation between the keyword to be detected and the keyword to be associated is established.
In an example (b-3), corresponding to the example (b-2), if the fact that the keyword to be detected, namely Bomei, belongs to the preset sub-category of the variety of the dog is detected, establishing an association relationship between the dog and Bomei, wherein the dog is a father keyword and Bomei is a son keyword; under the condition that the key word to be detected, namely the kokyi, belongs to a preset subcategory of the variety of the dog, establishing an association relationship between the dog and the kokyi, wherein the dog is a father key word and the kokyi is a son key word; under the condition that the key word to be detected of the large dog belongs to a preset sub-category of the body type of the dog, establishing an association relationship between the dog and the large dog, wherein the dog is a father key word and the large dog is a son key word; under the condition that the keyword to be detected, namely the small dog, belongs to a preset sub-category of the body type of the dog, establishing an association relationship between the dog and the small dog, wherein the dog is a father keyword and the small dog is a son keyword; under the condition that the keyword to be detected, namely the short hair, is detected to belong to a preset sub-category of the dog by Mao Zheyi, establishing an association relationship between the dog and the short hair, wherein the dog is a father keyword and the short hair is a son keyword; under the condition that the keyword to be detected, namely the long hair, is detected to belong to a preset sub-category of the dog by Mao Zheyi, establishing an association relation between the dog and the long hair, wherein the dog is a father keyword and the long hair is a son keyword; and under the condition that the black keyword to be detected belongs to the preset sub category of the fur color of the dog, establishing an association relationship between the dog and the black keyword, wherein the dog is a father keyword and the black keyword is a son keyword.
In the embodiment of the invention, through dividing each keyword in the keyword library into categories in advance, after determining the keywords to be associated, establishing an association relationship between the keywords and the preset sub-category corresponding to the category to which the keywords to be associated belong, wherein the vocabulary is used as the sub-keyword of the keywords to be associated and the keywords to be associated are used as the father keyword, so that each keyword in the keyword library can be associated with other keywords based on the category of the keyword.
In an embodiment of the present invention, referring to fig. 2-1, fig. 2-1 is a flowchart of a second image generating method according to an embodiment of the present invention, and the step S102 may specifically include the following step S102A.
S102A, determining and displaying alternative keywords corresponding to the prompt words and a preview effect diagram.
The preview effect diagram is an effect diagram corresponding to a phrase formed by updated prompt words and alternative keywords.
Corresponding to the above example (a-3), referring to fig. 2-2, fig. 2-2 is a schematic diagram showing alternative keywords and preview effect graphs provided in the embodiment of the present invention, each alternative keyword and an effect graph corresponding to a phrase formed by updated prompting words and alternative keywords may be displayed under the prompting words input by the prompting word input box, specifically, white, black, running, lying, beach, street, etc. alternative keywords are displayed under the prompting words input by the user, an effect graph corresponding to a phrase formed by a dog and white is displayed in a corresponding area of the white alternative keyword, an effect graph corresponding to a phrase formed by a dog and black is displayed in a corresponding area of the black alternative keyword, an effect graph corresponding to a phrase formed by a dog and running is displayed in a corresponding area of the alternative keyword, a corresponding effect graph formed by a dog and lying, a corresponding effect graph corresponding to a corresponding street, and a corresponding phrase formed by a corresponding dog and a corresponding phrase are displayed in a corresponding area of the lying alternative keyword. The corresponding area may be set according to the requirement, and in one example, a preview effect diagram corresponding to the candidate keyword is displayed on the left side of the candidate keyword.
In addition, the preview effect diagram of the phrase formed by the keywords can be stored in advance, so that when the alternative keywords are displayed, the effect diagram corresponding to the phrase formed by the alternative keywords and the prompt word updated previously can be correspondingly obtained, and the alternative keywords and the preview effect diagram can be simultaneously displayed to the user.
In the embodiment of the invention, the alternative keywords are displayed, the effect graph corresponding to the phrase formed by the alternative keywords and the prompt words updated previously is also displayed, so that a user can clearly know the effect of the image picture generated by the phrase formed by the prompted alternative keywords and the prompt words updated previously, the user can select the alternative keyword closest to the expected image picture as the next prompt word according to the preview effect graph, the accuracy of the input prompt word is greatly improved, the accuracy of the image generated subsequently is greatly improved, and the preview effect graph can be displayed in real time, the user does not need to generate the image after inputting all the prompt words, and the efficiency of generating the image is also greatly improved.
In an embodiment of the present invention, referring to fig. 3, fig. 3 is a flowchart of a third image generating method according to an embodiment of the present invention, and the step S105 may specifically include the following steps S105A to S105C.
S105A, judging whether the number of the updated prompt words reaches the preset number.
The preset number can be limited according to actual requirements. In addition, the preset number can be correspondingly set according to the type of the target father keyword in the updated prompt word. The preset number corresponding to different types can also be set according to requirements, wherein the target father keywords are keywords which are only used as father keywords in the association relation corresponding to the updated prompting words, and the situation that the target father keywords are used as sub-keywords in the association relation corresponding to the updated prompting words does not exist.
Corresponding to the example (a-7), the updated hint words include dogs, beach sand and coconut tree, and the corresponding association relationship is dogs and beach sand and coconut tree, wherein if the dog is only the father keyword, the dog is determined to be the target father keyword.
In one example, in the case where the dog is the target parent keyword, the dog is determined to be of the animal type, and the preset number is set to be 5. Under the condition that mango trees are target father keywords, determining the mango trees to be plant types, and considering that animal types are more complex than plant types under the general condition, setting smaller preset number for the plant types and setting the preset number of the plant types to be 4.
In one example (c-1), if the preset number is 3, corresponding to the above example (a-7), after receiving the picture generation instruction input by the user, it is determined that the number of the updated prompting words 3 corresponding to the dogs, the beach and the coconut tree reaches the preset number 3.
In one example (c-2), if the preset number is 4, corresponding to the above example (a-7), after receiving the picture generation instruction input by the user, it is determined that the number 3 of the prompt words corresponding to the updated dog, beach and coconut tree does not reach the preset number 4.
And S105B, if the number of the updated prompt words reaches the preset number, generating a target image based on the updated prompt words.
Corresponding to the above example (c-1), a target image including the contents of the dog, beach, coconut tree is generated based on the dog, beach, coconut tree.
S105C, if the number of the updated prompting words does not reach the preset number, determining the last prompting word in the updated prompting words as a new prompting word.
Corresponding to the above example (c-1), coconut tree was used as a new hint word.
After the execution of the above step S105C, the above step S102 is repeatedly executed.
Corresponding to the example (c-1) above, two alternative keywords, namely, cat and dog, corresponding to the coconut tree may be displayed continuously.
In addition, the new prompt word may be a prompt word selected by the user. In one example, in the above (2-1), when the user selects the dog as a new prompting word, the candidate keywords corresponding to the dog may be displayed later, so that the user may describe the prompting word further described in more detail according to the requirement of the user.
In the embodiment of the invention, the preset number is limited, so that the user can exit the input process to generate the target image only when the preset number is reached, and the preset number can be set according to the requirement, therefore, the user can generate the target image only when the input prompting words describe the expected image picture sufficiently, the generated target image can have smaller gap with the expected image picture, and the accuracy of the image is improved.
In an embodiment of the present invention, referring to fig. 4, fig. 4 is a flowchart of a fourth image generating method according to an embodiment of the present invention, after the step S102 is performed, the following step S106 may be further included.
S106, when the prompting word input by the user is received, the input prompting word is determined to be a new prompting word input by the user.
In one example (d-1), it is assumed that in the case of example (a-6), the first selection instruction input by the user is not received, and the prompt word input by the user is received: mango trees are used as new prompt words input by users.
In one example (d-2), it is assumed that in the case of example (a-3), the first selection instruction input by the user is not received, and the prompt word input by the user is received: white, the white is used as a new prompt word input by the user.
Step S102 is repeatedly performed after step S106 is performed.
Corresponding to the example (d-1) above, two alternative keywords, namely, cat and dog, corresponding to the mango tree may be displayed continuously.
In addition, if the latest updated prompting word does not have the corresponding alternative keyword, the alternative keyword corresponding to the latest prompting word with the alternative keyword in the updated prompting words can be displayed.
Corresponding to the above example (d-2), in the case where the white color has no corresponding candidate keyword, the candidate keyword corresponding to the dog may be displayed.
In addition, in the case that the user wants to describe the prompt word after the previous update again, the user can directly input the keyword describing the prompt word to be described, and if the input keyword is a sub-keyword which only describes the prompt word to be described in the prompt word after the previous update, the input keyword is determined to be a vocabulary which specifically describes the prompt word to be described; if the input keywords are sub-keywords which can be used for describing a plurality of prompt words after being updated previously, the user can be prompted to input a selection instruction for the prompt words to be described, and under the condition that the user inputs the selection instruction for the prompt words to be described, the input keywords are determined to be words which are specifically described for the selected prompt words to be described.
In one example (d-3), assume that the previously updated hint words are: the method comprises the steps of dog, beach and coconut tree, if a user needs to describe beach again and inputs mango tree, the mango tree is used as the vocabulary for describing beach only when the mango tree is the vocabulary for describing beach, if the mango tree is not only the vocabulary for describing beach but also the vocabulary for describing dog, the user can be prompted to input a selection instruction for prompt words to be described, the user selects beach as the prompt words to be described according to the requirement, and the keyword used as the input determination is the vocabulary for specifically describing beach.
In addition, the previously updated hint words can be described again by: receiving a re-description instruction for a prompt word to be described, which is input by a user, for example, the user may click on a certain prompt word determined previously, determine that the re-description instruction for the prompt word is received, and after receiving the re-description instruction, may execute the step S102, and display a keyword corresponding to the prompt word, so that the user may describe based on the prompt word again.
In the embodiment of the invention, under the condition that the prompting word input by the user is received, the input prompting word is determined to be a new prompting word input by the user, and the alternative keywords corresponding to the new prompting word are displayed, so that the prompting direction can be adjusted in real time according to the prompting word input by the user in real time, the prompting direction is ensured to accord with the expression direction of the user on the expected image picture, the user can describe the expected image picture more conveniently and rapidly, and the image generating efficiency is improved.
In an embodiment of the present invention, referring to fig. 5, fig. 5 is a flowchart of a fifth image generating method according to an embodiment of the present invention, and the step S105 may specifically include the following steps S1051 to S1052.
S1051, sorting the updated prompt words, and generating sorted phrases.
The prompting words positioned behind the word group in the adjacent prompting words in the ordered word group are sub-keywords of the prompting words positioned in front of the word group. And arranging the updated prompting words according to the sequence that the prompting words positioned behind the phrase are the sub-keywords positioned in front of the phrase in the adjacent prompting words, wherein the sequence is used as a standard sequence.
Specifically, a keyword which is only used as a father keyword is determined from updated prompt words, the first keyword is used as a phrase, then a sub-keyword corresponding to the first keyword is determined from the current residual keywords (without the first keyword) and is used as a second keyword, then a sub-keyword corresponding to the second keyword is determined from the residual keywords (without the first keyword and the second keyword), and the like, until the keyword which is only used as the sub-keyword is determined from the residual keywords, the sequence of the updated prompt words is realized.
In addition, in the process of selecting the vocabulary, training of the sequence of the input vocabulary may be also involved, specifically, the prompting words may be input according to the sequence that the prompting words located at the rear of the phrase are sub-keywords of the prompting words located at the front of the phrase in the adjacent prompting words, then the prompting words are input according to the sequence that the prompting words located at the front of the phrase are sub-keywords of the prompting words located at the rear of the phrase in the adjacent prompting words, comparing the generated images in the two modes, determining that the generated images in the corresponding mode of the two modes are more in line with the expectation, and therefore ordering the input prompting words according to the standard sequence is needed.
In an example (e-1), corresponding to the example (a-7), after receiving the picture generation instruction, the dogs, the beach, and the coconut tree are ranked, and a ranked phrase is generated according to the arrangement of the dogs, the beach, and the coconut tree.
In addition, if the user inputs a plurality of prompt words, when the sequence of the input plurality of prompt words does not accord with the standard sequence, a sequencing prompt can be displayed, when the user determines to modify the sequence, the input prompt words are sequenced according to the standard sequence, and the last prompt word of the sequenced phrase is determined to be the prompt word of the candidate keyword to be displayed. Therefore, the sequence of the input prompt words can be timely adjusted, so that the generated phrases are more standard and accurate, and the accuracy of the subsequent generated images based on the ordered phrases is improved.
S1052, generating a target image based on the ordered phrase.
Corresponding to the example (e-1), a target image is generated, which is mainly the dog, the scene where the dog is located, the beach on which the coconut tree is present, based on the ordered phrases arranged by the dog, the beach, the coconut tree.
Specifically, a preset number of target effect graphs can be generated based on the ordered phrases, a target effect graph selection instruction input by a user is received, and the target effect graph indicated by the target effect graph selection instruction is determined to be a target image. Therefore, images generated based on the ordered phrases can be screened before the target images are generated, and the image which is selected by the user and most accords with the expected is taken as the target image, so that the accuracy of the generated target image is greatly improved. The preset number can be determined according to actual requirements.
In the embodiment of the invention, the updated prompt words are sequenced, and the target image is generated based on the sequenced phrases, so that the sequence among the prompt words in the phrases is optimized, and the target image is generated based on the sequenced phrases more accurately.
In one embodiment of the present invention, each keyword in the keyword library includes a parameter for performing image processing on the content represented by the keyword.
The above parameters may include: the aspect ratio of the content represented by the keywords, the rendering time of the content represented by the keywords, an algorithm for performing image processing on the content represented by the keywords, the resolution, contrast, and the like of the content represented by the keywords. The specific parameters for performing image processing can be referred to in the related art, and will not be described herein.
Parameters corresponding to different keywords can be consistent or inconsistent, and the parameters can be determined according to actual requirements of the keywords.
In one example (f-1), the dog term contains parameters that are: aspect ratio of the dog and rendering time of the dog.
Referring to fig. 6, fig. 6 is a schematic flow chart of a sixth image generating method according to an embodiment of the present invention, after the embodiment shown in fig. 1-1 has performed the above step S101 or step S104, the following steps S107 to S109 may be further performed, and the step S105 may specifically include the following step S1010.
S107, determining parameters contained in the keywords which are the same as the prompt words in the keyword library.
In an example (f-2), corresponding to the above example (f-1), if the keyword input by the user is received or the keyword newly determined by the user is a dog, the parameters included in the dog are determined as follows: aspect ratio of the dog and rendering time of the dog.
S108, generating and displaying a parameter configuration interface of the parameters.
Corresponding to the example (f-2), a parameter configuration interface of the aspect ratio of the dog and a parameter configuration interface of the rendering time of the dog are generated and displayed.
S109, based on the configuration instruction input by the user on the parameter configuration interface, generating parameter information including the parameter and the parameter value of the parameter indicated by the configuration instruction, and taking the parameter information as the parameter information of the prompt word.
In an example (f-3), corresponding to the above example (f-2), if the configuration instruction input by the user indicates that the aspect ratio of the dog is 16:9 and the rendering time of the dog is 1ms, parameter information of the dog, that is, parameter information of the dog, is generated.
In addition, after the above step S109 is performed, step S103 may be continued to be performed. After step S103 is performed, steps S107 to S109 may be performed, and step S104 may be performed after step S109 is performed.
S1010, generating a target image according to the updated prompt words and the parameter information of each prompt word.
Specifically, a target image is generated according to the content represented by each prompt word in the updated prompt words and the parameter information of the prompt words.
Corresponding to the example (f-3), assuming that the updated prompt word only includes a dog, an image of the dog with an aspect ratio of 16:9 and a rendering time of 1ms is generated as a target image.
In the embodiment of the invention, the parameter information of the prompt word is generated based on the configuration instruction input by the user on the parameter configuration interface, wherein the parameter information comprises the parameter value of the parameter for carrying out image processing on the content represented by the prompt word, so that when the target image is generated, the image can be processed according to the parameter value configured by the user, and the generated image effect is more in line with expectations.
In one embodiment of the invention, each keyword in the keyword library is associated in a tree form based on an association relationship between keywords, a parent keyword representing a description topic in the association relationship is contained in a root node aiming at the description topic in the tree, and a child keyword representing the description topic in the association relationship is contained in a child node aiming at the description topic in the tree.
Specifically, the keywords in the keyword library may be distributed according to a tree structure. In one association relationship, a parent keyword in the association relationship is contained in a root node of a tree of a description topic corresponding to the parent keyword in the tree structure, and a child keyword in the association relationship is contained in a child node of the tree of the description topic corresponding to the parent keyword in the tree structure.
In one example, in the association between the dog and the white, the dog is a root node of the number of dogs and the white is a child node of the number of dogs, corresponding to the example (a-1).
There may be different numbers based on the topic of description, and each vocabulary that may be a parent keyword may correspond to a root node of a tree. Thus, a plurality of trees are included in the tree structure.
If a keyword includes a plurality of associations with the keyword as a parent keyword in a keyword library, if the keyword is included in a root node of a tree for the keyword, the root node may correspond to a plurality of child nodes, and each child node of the tree includes a child keyword in the associations with the keyword as a parent keyword.
In one example (7-1), corresponding to the above example (a-1), there are a plurality of relationships in which the dog is included in the root node of the tree for the dog and the white, black, running, lying, beach, street are included in the child nodes for the dog, respectively.
If a keyword is used as a parent keyword or a child keyword, the keyword is included in a root node of a tree for the keyword when the keyword is used as a parent keyword, and the keyword is included in a child node of a tree for another description topic when the keyword is used as a child keyword, so that the tree for another description topic can be associated with the tree for the keyword, that is, different trees can be associated with each other. The method and the device can provide the keywords corresponding to the nodes in one tree for the keywords corresponding to the nodes in the other tree when the keywords prompted by the user are provided later, so that the prompted keywords are richer and more complete, and the generated image is more complete and accurate.
In one example (7-2), corresponding to the above example (a-1), for the keyword of beach, in the association of beach and coconut tree, beach is included in the root node of the tree for beach, and in the association of dog and beach, beach is included in the child node of the tree for dog, so that the tree for dog can be associated with the tree for beach.
Referring to fig. 7, fig. 7 is a schematic diagram of associating keywords in a tree structure, where an arrow points from a root node to a child node, and a straight line indicates that two trees can be associated with each other. The tree structure in fig. 7 is constructed based on the association relationship in the above example (a-1). As shown in fig. 7, in tree 1 for which animals are the descriptive subject, animals are root nodes, and cats and dogs are child nodes under the root node of animals; in tree 2 for dogs as descriptive subject, dogs are root nodes, white, black, running, lying flat, beach, street are child nodes under the root node of dogs; in tree 3 for which beach is the descriptive topic, beach is the root node and flowers, grasses, coconut trees and mango trees are all child nodes under the root node of beach; in tree 4, which is a descriptive subject for coconuts, coconuts are root nodes, and dogs and cats are child nodes under the root node of coconuts; in tree 5, which is the descriptive subject for mango trees, the mango tree is the root node, and dogs and cats are child nodes under the root node of the mango tree.
In the tree structure shown in fig. 7, the node of the dog may be a root node or a child node, the node of the beach may be a root node or a child node, the node of the coconut tree may be a root node or a child node, and the node of the mango tree may be a root node or a child node. Also, the tree 2 for describing the subject for dogs can be correlated with the tree 3 for describing the subject for beach, the tree 3 for describing the subject for beach can be correlated with the tree 4 for describing the subject for coconut tree and the tree 5 for describing the subject for mango tree, and both the tree 4 for describing the subject for coconut tree and the tree 5 for describing the subject for mango tree can be correlated with the tree 2 for describing the subject for dogs.
In an example, referring to fig. 8, fig. 8 is a flowchart of a seventh image generating method according to an embodiment of the present invention, where the method may include the following steps S801 to S805.
S801, receiving a prompt word input by a user.
In one example (g-1), the prompt word received in the user input is a dog.
S802, determining and displaying keywords corresponding to the prompting words in all child nodes of the node where the tree structure is located, and taking the keywords as candidate keywords.
In an example (g-2), corresponding to the above example (g-1), assuming that the tree structure is the structure shown in fig. 7, white, black, running, lying flat, beach, street corresponding to the child node under the node of the dog may be determined as an alternative keyword.
S803, determining target keywords according to the received first selection instruction, and updating prompt words according to the target keywords and the prompt words.
In one example (g-3), assuming that in the case of example (g-2), the first selection instruction input by the user is received and the selected target keyword is beach, then beach is determined as a new prompt word input by the user.
After the above step S803 is performed, step S804 may be performed.
S804, judging whether a picture generation instruction input by a user is received.
In the case where the picture generation instruction is not received, the above-described step S802 is repeatedly executed.
In one example (g-4), it is assumed that in the above example (g-3), after the beach is determined as a new hint word input by the user, the flowers, grasses, coconut trees, and mango trees corresponding to child nodes below the node of the beach are determined and displayed as alternative keywords, assuming that the input picture generation instruction is not received.
S805, generating a target image according to the updated prompt word.
In one example (g-5), assuming that in the above example (g-4), after the beach is determined as a new prompt word input by the user, a picture generation instruction input by the user is received, a target image including dogs and the beach as image contents is generated.
Specifically, the updated prompt words may be ordered according to the structure sequence of the tree structure, so as to generate ordered phrases, and based on the ordered phrases, a target image is generated. The structural order in the tree structure is the arrangement order of the nodes.
In one example, assume that the order of the updated hint words is: dog, animal, coconut tree, beach, then in the tree structure shown in fig. 7, the ordered phrase of animal, dog, beach, coconut tree will be generated based on the structural order of the tree structure, the structural order can see the direction of the arrow, the direction of the arrow is the direction of the structural order of the tree structure.
In addition, the priority order of the peer nodes can be set for the peer nodes, namely, for different child nodes of the same node, and when the updated prompt words are ordered, the updated prompt words can be ordered based on the structure order in the tree structure and the priority order of the peer nodes, so that an ordered phrase is generated. The priority of the peer nodes can be set according to requirements, specifically, the priority of the peer nodes can be trained, and the order with the best graph effect is determined as the same-level priority.
In one example, the order of the updated hint words is: dog, white, animal, coconut tree, beach, assuming that the priority of two sibling nodes, white and coconut tree, is: white and coconut tree, in the tree structure shown in fig. 7, the arrangement sequence of the generated ordered phrases is as follows: animal, dog, white, beach, coconut tree.
In the embodiment of the invention, the association relation among the keywords is subjected to tree association to form a tree structure, so that the association relation among the keywords can be intuitively and clearly embodied, thereby realizing more complete management of the keywords, the keywords corresponding to the child nodes of the node corresponding to the prompting word can be directly displayed to a user as alternative keywords, and the sequence of the updated prompting words in the tree structure can be further ordered.
In a second aspect, an embodiment of the present invention provides an image generating apparatus, applied to an electronic device, where a keyword library is stored in the electronic device, each keyword in the keyword library is associated based on an association relationship between keywords, each keyword is a word that describes an image and is selected in advance, the association relationship includes a parent keyword that characterizes a description topic and a sub-keyword that characterizes the description topic, referring to fig. 9, and fig. 9 is a schematic structural diagram of the image generating apparatus provided in the embodiment of the present invention, where the apparatus includes:
The prompt word receiving module 901 is configured to receive a prompt word input by a user;
the keyword display module 902 is configured to determine and display an alternative keyword corresponding to the prompt word; the target keywords are sub-keywords in the association relation of the keyword library by taking the prompt words as parent keywords;
the instruction receiving module 903 is configured to determine a target keyword according to the received first selection instruction, update a prompt word according to the target keyword and the prompt word, and repeatedly execute the steps of determining and displaying an alternative keyword corresponding to the prompt word until a picture generation instruction input by a user is received;
the image generating module 904 is configured to generate a target image according to the updated prompt word.
In the embodiment of the invention, after the prompting word input by the user is received, the user can perform the next description according to the displayed alternative keyword by determining and displaying the alternative keyword corresponding to the prompting word, and a targeted prompting is provided for the prompting word input by the user, because the displayed alternative keyword is a word which is selected in advance and is used for describing the image, and the selected word is more professional and normative than the word input by the inexperienced user, the user can input the prompting word with more professional and normative according to the prompting alternative keyword, and because the prompting alternative keyword is a sub-keyword in the association relation of the prompting word as a father keyword in the keyword library, the alternative keyword is used for describing the prompting word, thereby guiding the user to perform more specific description on the scene in the prediction, prompting the user to input more prompting words, further generating the image based on the updated more professional and specific prompting word, and improving the accuracy of the generated target image.
In one embodiment of the present invention, the apparatus further includes a relationship establishing module, configured to establish an association relationship between keywords by: determining a target category of keywords to be associated and a preset subcategory corresponding to the target category, wherein the keywords to be associated are any keywords in a keyword library, the target category is the category to which the keywords to be associated belong, and the vocabulary belonging to the preset subcategory is used for describing the vocabulary belonging to the target category; under the condition that the keywords to be detected belong to preset subcategories, the keywords to be associated are taken as father keywords, the keywords to be detected are taken as child keywords, the association relation between the keywords to be associated and the keywords to be detected is established, and the keywords to be detected are keywords except the keywords to be associated in a keyword library.
In the embodiment of the invention, through dividing each keyword in the keyword library into categories in advance, after determining the keywords to be associated, establishing an association relationship between the keywords and the preset sub-category corresponding to the category to which the keywords to be associated belong, wherein the vocabulary is used as the sub-keyword of the keywords to be associated and the keywords to be associated are used as the father keyword, so that each keyword in the keyword library can be associated with other keywords based on the category of the keyword.
In one embodiment of the present invention, the keyword display module 902 is specifically configured to: and determining and displaying the alternative keywords corresponding to the prompt words and a preview effect diagram, wherein the preview effect diagram is an effect diagram corresponding to a phrase formed by the updated prompt words and the alternative keywords.
In the embodiment of the invention, the alternative keywords are displayed, the effect graph corresponding to the phrase formed by the alternative keywords and the prompt words updated previously is also displayed, so that a user can clearly know the effect of the image picture generated by the phrase formed by the prompted alternative keywords and the prompt words updated previously, the user can select the alternative keyword closest to the expected image picture as the next prompt word according to the preview effect graph, the accuracy of the input prompt word is greatly improved, the accuracy of the image generated subsequently is greatly improved, and the preview effect graph can be displayed in real time, the user does not need to generate the image after inputting all the prompt words, and the efficiency of generating the image is also greatly improved.
In one embodiment of the present invention, the image generating module 904 is specifically configured to: judging whether the number of the updated prompting words reaches the preset number or not; if the number of the updated prompting words reaches the preset number, generating a target image based on the updated prompting words; if the number of the updated prompting words does not reach the preset number, determining the last prompting word in the updated prompting words as a new prompting word, and repeatedly executing the steps of determining and displaying the alternative keywords corresponding to the prompting words.
In the embodiment of the invention, the preset number is limited, so that the user can exit the input process to generate the target image only when the preset number of the prompting words input by the user is reached, and the preset number can be set according to the requirement, therefore, the user can generate the target image only under the condition that the input prompting words describe the expected image picture sufficiently, the generated target image can have smaller gap with the expected image picture, and the accuracy of the image is improved.
In one embodiment of the present invention, the apparatus further includes: and the prompt word determining module is used for determining the input prompt word as a new prompt word input by the user and repeatedly executing the steps of determining and displaying the candidate keyword corresponding to the prompt word under the condition that the prompt word input by the user is received after the candidate keyword corresponding to the prompt word is determined and displayed.
In the embodiment of the invention, under the condition that the prompting word input by the user is received, the input prompting word is determined to be a new prompting word input by the user, and the alternative keywords corresponding to the new prompting word are displayed, so that the prompting direction can be adjusted in real time according to the prompting word input by the user in real time, the prompting direction is ensured to accord with the expression direction of the user on the expected image picture, the user can describe the expected image picture more conveniently and rapidly, and the image generating efficiency is improved.
In one embodiment of the present invention, the image generating module 904 is specifically configured to: sorting the updated prompting words to generate sorted word groups, wherein prompting words positioned behind the word groups in adjacent prompting words in the sorted word groups are sub-keywords of the prompting words positioned in front of the word groups; and generating a target image based on the ordered phrase.
In the embodiment of the invention, the updated prompt words are sequenced, and the target image is generated based on the sequenced phrases, so that the sequence among the prompt words in the phrases is optimized, and the target image is generated based on the sequenced phrases more accurately.
In one embodiment of the present invention, each keyword in the keyword library includes a parameter for performing image processing on a content represented by the keyword, and the apparatus further includes: the parameter determining module is used for determining parameters contained in the keywords which are the same as the prompt words in the keyword library; generating and displaying a parameter configuration interface of the parameters; based on a configuration instruction input by a user on a parameter configuration interface, generating parameter information containing parameters and parameter values of parameters indicated by the configuration instruction, wherein the parameter information is used as parameter information of a prompt word;
the image generation module is specifically configured to: and generating a target image according to the updated prompt words and the parameter information of each prompt word.
In the embodiment of the invention, the parameter information of the prompt word is generated based on the configuration instruction input by the user on the parameter configuration interface, wherein the parameter information comprises the parameter value of the parameter for carrying out image processing on the content represented by the prompt word, so that when the target image is generated, the image can be processed according to the parameter value configured by the user, and the generated image effect is more in line with expectations.
In one embodiment of the invention, each keyword in the keyword library is associated in a tree form based on an association relationship between keywords, a parent keyword representing a description topic in the association relationship is contained in a root node aiming at the description topic in the tree, and a child keyword representing the description topic in the association relationship is contained in a child node aiming at the description topic in the tree.
In the embodiment of the invention, the association relation among the keywords is subjected to tree association to form a tree structure, so that the association relation among the keywords can be intuitively and clearly embodied, thereby realizing more complete management of the keywords, the keywords corresponding to the child nodes of the node corresponding to the prompting word can be directly displayed to a user as alternative keywords, and the sequence of the updated prompting words in the tree structure can be further ordered.
The embodiment of the present invention further provides an electronic device, referring to fig. 10, fig. 10 is a schematic structural diagram of the electronic device provided in the embodiment of the present invention, as shown in fig. 10, including a processor 1001, a communication interface 1002, a memory 1003, and a communication bus 1004, where the processor 1001, the communication interface 1002, and the memory 1003 complete communication with each other through the communication bus 1004,
a memory 1003 for storing a computer program;
the processor 1001 is configured to implement any of the steps of the image generation method described above when executing the program stored in the memory 1003.
When the communication satellite provided by the embodiment of the invention is used for generating the image, after the prompting word input by the user is received, the user can perform the next description according to the displayed prompting word by determining and displaying the corresponding alternative keyword of the prompting word, and a targeted prompting is provided for the prompting word input by the user.
The communication bus mentioned above for the electronic devices may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
In yet another embodiment of the present invention, there is also provided a computer-readable storage medium having stored therein a computer program which, when executed by a processor, implements the steps of any of the image generation methods described above.
When the computer program stored in the computer readable storage medium provided by the embodiment of the invention is used for generating an image, after receiving a prompting word input by a user, the user can perform next description according to the displayed prompting word by determining and displaying the corresponding prompting word, and provide a targeted prompting for the prompting word input by the user.
In a further embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the image generation methods of the above embodiments.
When the computer program product provided by the embodiment of the invention is used for generating the image, after the prompting word input by the user is received, the user can perform the next description according to the displayed prompting word by determining and displaying the corresponding alternative keyword of the prompting word, and a targeted prompting is provided for the prompting word input by the user.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present invention, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), etc.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for an apparatus, an electronic device, a computer program product, a computer readable storage medium embodiment, the description is relatively simple, as it is substantially similar to the method embodiment, and relevant references are made to the partial description of the method embodiment.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims (10)

1. The image generation method is characterized by being applied to electronic equipment, wherein a keyword library is stored in the electronic equipment, each keyword in the keyword library is associated based on association relation among keywords, each keyword is a word which is selected in advance and used for describing an image, the association relation comprises a father keyword representing a description theme and a child keyword representing the description theme, and the method comprises the following steps:
receiving a prompt word input by a user;
determining and displaying alternative keywords corresponding to the prompt words; wherein the candidate keywords are sub-keywords in the association relation of the keyword library by taking the prompting words as parent keywords;
determining a target keyword according to the received first selection instruction, updating the prompting word according to the target keyword and the prompting word, and repeatedly executing the steps of determining and displaying the candidate keyword corresponding to the prompting word until receiving the picture generation instruction input by the user;
And generating a target image according to the updated prompt word.
2. The method according to claim 1, wherein the association relationship between the keywords is established by:
determining a target category of a keyword to be associated and a preset subcategory corresponding to the target category, wherein the keyword to be associated is any keyword in the keyword library, the target category is a category to which the keyword to be associated belongs, and the vocabulary belonging to the preset subcategory is used for describing the vocabulary belonging to the target category;
and under the condition that the keywords to be detected belong to the preset sub-category, taking the keywords to be associated as father keywords, taking the keywords to be detected as sub-keywords, and establishing the association relation between the keywords to be associated and the keywords to be detected, wherein the keywords to be detected are keywords except the keywords to be associated in the keyword library.
3. The method of claim 1, wherein generating the target image from the updated hint words comprises:
sorting the updated prompting words to generate sorted word groups, wherein prompting words positioned behind the word groups in adjacent prompting words in the sorted word groups are sub-keywords of the prompting words positioned in front of the word groups;
And generating a target image based on the ordered phrase.
4. The method of claim 1, wherein each keyword in the keyword library includes a parameter for performing image processing on content represented by the keyword, and further comprising:
determining parameters contained in the keywords which are the same as the prompting words in the keyword library;
generating and displaying a parameter configuration interface of the parameter;
based on a configuration instruction input by the user on the parameter configuration interface, generating parameter information containing the parameters and parameter values of the parameters indicated by the configuration instruction, wherein the parameter information is used as the parameter information of the prompt word;
generating the target image according to the updated prompt word comprises the following steps:
and generating a target image according to the updated prompt words and the parameter information of each prompt word.
5. The method according to any one of claims 1-4, wherein each keyword in the keyword library is tree-associated based on an association relationship between keywords, a parent keyword representing a descriptive topic is included in a root node in a tree for the descriptive topic, and a child keyword representing the descriptive topic is included in a child node in the tree for the descriptive topic.
6. The method according to any one of claims 1-4, further comprising: after the candidate keywords corresponding to the prompt words are determined and displayed, the method further comprises the following steps: and under the condition that the prompting word input by the user is received, determining the input prompting word as a new prompting word input by the user, and repeatedly executing the steps of determining and displaying the alternative keywords corresponding to the prompting word.
7. The method according to any one of claims 1-4, wherein the determining and displaying the candidate keywords corresponding to the prompt word includes:
and determining and displaying the alternative keywords corresponding to the prompt words and a preview effect diagram, wherein the preview effect diagram is an effect diagram corresponding to a phrase formed by the updated prompt words and the alternative keywords.
8. The method according to claim 1 or 2, wherein generating the target image from the updated hint words comprises:
judging whether the number of the updated prompting words reaches the preset number or not;
if the number of the updated prompting words reaches the preset number, generating a target image based on the updated prompting words;
if the number of the updated prompting words does not reach the preset number, determining the last prompting word in the updated prompting words as a new prompting word, and repeatedly executing the steps of determining and displaying the alternative keywords corresponding to the prompting words.
9. An image generating apparatus, which is applied to an electronic device, wherein a keyword library is stored in the electronic device, each keyword in the keyword library is associated based on an association relation between keywords, each keyword is a word which is selected in advance and describes an image, the association relation includes a parent keyword representing a description theme and a child keyword representing the description theme, and the apparatus includes:
the prompt word receiving module is used for receiving the prompt word input by the user;
the keyword display module is used for determining and displaying alternative keywords corresponding to the prompting words; wherein the candidate keywords are sub-keywords in the association relation of the keyword library by taking the prompting words as parent keywords;
the instruction receiving module is used for determining a target keyword according to the received first selection instruction, updating the prompting word according to the target keyword and the prompting word, and repeatedly executing the steps of determining and displaying the candidate keyword corresponding to the prompting word until receiving the picture generation instruction input by the user;
and the image generation module is used for generating a target image according to the updated prompt word.
10. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1-8 when executing a program stored on a memory.
CN202311154684.6A 2023-09-07 2023-09-07 Image generation method and device, electronic equipment and storage medium Pending CN117272987A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311154684.6A CN117272987A (en) 2023-09-07 2023-09-07 Image generation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311154684.6A CN117272987A (en) 2023-09-07 2023-09-07 Image generation method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117272987A true CN117272987A (en) 2023-12-22

Family

ID=89211404

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311154684.6A Pending CN117272987A (en) 2023-09-07 2023-09-07 Image generation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117272987A (en)

Similar Documents

Publication Publication Date Title
CN110046706B (en) Model generation method and device and server
CN109508419A (en) A kind of recommended method and system of knowledge based study
CN108052394A (en) The method and computer equipment of resource allocation based on SQL statement run time
CN111143684B (en) Artificial intelligence-based generalized model training method and device
CN113536144B (en) Social network information propagation scale prediction method and device
Coelho et al. Building Machine Learning Systems with Python: Explore machine learning and deep learning techniques for building intelligent systems using scikit-learn and TensorFlow
AU2014203218A1 (en) Memory configuration for inter-processor communication in an MPSoC
Agarwal et al. Empirical analysis of five nature-inspired algorithms on real parameter optimization problems
CN113449821B (en) Intelligent training method, device, equipment and medium fusing semantics and image characteristics
CN107885503A (en) A kind of iteration based on performance of program analysis compiles optimization method
CN112132208A (en) Image conversion model generation method and device, electronic equipment and storage medium
CN110992124A (en) House resource recommendation method and system
CN108520034B (en) Application recommendation method and device and computer equipment
CN116204847A (en) Calculation graph optimization method, device and equipment
CN117272987A (en) Image generation method and device, electronic equipment and storage medium
CN116383521B (en) Subject word mining method and device, computer equipment and storage medium
US20230229941A1 (en) Rule induction to find and describe patterns in data
CN112527288A (en) Visual system prototype design method, system and storage medium capable of generating codes
CN117407505A (en) Question-answer retrieval method and system for integrating document knowledge and question-answer data
CN109992723B (en) User interest tag construction method based on social network and related equipment
CN112507214A (en) Data processing method, device, equipment and medium based on user name
CN109255124B (en) Web service comprehensive score calculation method based on OWL-S
Song AutoFE: efficient and robust automated feature engineering
CN117216193B (en) Controllable text generation method and device based on large language model
CN112417086B (en) Data processing method, device, server and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination