Image generation method, system and device for public space and medium
By accurately capturing user needs and matching the optimal model and prompt word combination strategy, personalized prompt word text is solved, and the problem of image uncertainty in public space image generation is achieved, and the high degree of fit between images and user needs and the improvement of user experience is achieved.
Patent Information
- Application Number
- CN202411734365.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-04
AI Technical Summary
In the prior art In the public space image generation, when a user uses the same words to generate an image, the uncertainty caused by different expression methods makes it difficult for the generated image to be exactly matched with the user's expectations.
By accurately capturing user needs, matching the optimal model and prompt word combination strategy, personalized prompt word text is constructed to generate spatial images that are highly consistent with user needs.
It improves the compatibility between image generation and user needs, improves the user experience, and reduces the uncertainty of image generation.
Smart Images

Figure CN119559300A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image generation method, system, device and medium for public space. Background Art
[0002] In order to improve the design and planning of public spaces, artificial intelligence is usually used to generate images of public spaces to facilitate users to make further modifications.
[0003] However, in actual operation, when users use the same words to generate images, the model may generate completely different spatial images due to different expressions of related words, which increases the uncertainty of the image generation results and makes it difficult for the generated images to fully match the user's expectations.
[0004] Therefore, it is necessary to propose an image generation method, system, device and medium for public spaces. Summary of the invention
[0005] This specification provides a method, system, device and medium for generating an image of a public space, which can improve the user experience by accurately capturing user needs, matching the optimal model and prompt word combination strategy, and constructing personalized prompt word text so that the generated spatial image is highly consistent with user needs.
[0006] The present application provides a method for generating an image for a public space using the following technical solution, including:
[0007] Obtaining the user's image generation requirements; the image generation requirements include: scene information and description content;
[0008] Based on the scene information, matching the corresponding target image generation model and prompt word combination strategy;
[0009] Combining the description content with the prompt word combination strategy, constructing a prompt word text;
[0010] The prompt word text is input into the target image generation model to obtain a target space image corresponding to the image generation requirement.
[0011] Optionally, the scene information includes: target style and target space type;
[0012] The matching of the corresponding target image generation model and prompt word combination strategy based on the scene information includes:
[0013] The target image generation model corresponding to the target style is searched; and according to the target space type, the prompt word combination strategy matching it is searched.
[0014] Optionally, the method further includes: pre-building a first preset template corresponding to the space type based on the association relationship between the space type and the prompt word combination strategy;
[0015] The obtaining of the user's image generation requirement includes:
[0016] According to the target space type selected by the user, a corresponding first preset template is retrieved for selection by the user;
[0017] Based on the user selection result, the description content is generated according to the order of each target prompt word in the first preset template and the attribute options of each target prompt word.
[0018] Optionally, the combining the description content and the prompt word combination strategy to construct the prompt word text includes:
[0019] Extracting each target prompt word from the description content, and determining a prompt attribute of each target prompt word;
[0020] Combining the target prompt word and its prompt attribute and the prompt word combination strategy, constructing the prompt word text;
[0021] The prompt word text is adjusted according to the special instructions in the description content.
[0022] Optionally, adjusting the prompt word text according to special instructions in the description content includes:
[0023] Identify whether there is a special word in the short sentence where the target prompt word is located;
[0024] If the special word exists, the prompt word text is optimized based on the type of the special word, wherein, when there is a positive special word in the short sentence where the target prompt word is located, a first text is constructed; the first text is used to represent an increase in the target weight of the target prompt word; when there is a negative special word in the short sentence where the target prompt word is located, a second text is constructed; the second text is used to represent a decrease in the target weight of the target prompt word.
[0025] Optionally, also include:
[0026] Construct image training sets and image generation models, and determine the prompt word combination strategy;
[0027] The image training set is input into the corresponding image generation model for training to determine the prompt word combination strategy of the corresponding space type; wherein, the output image with the highest similarity to the historical image is identified, and the current weight of the prompt word corresponding to the output image is used as the target weight; the current order of the prompt words corresponding to the output image is used as the target order, and the prompt word combination strategy is constructed by combining the target weight and target order of the prompt words.
[0028] The present application provides an image generation system for public spaces using the following technical solutions, including:
[0029] An acquisition module is used to acquire the image generation requirements of the user; the image generation requirements include: scene information and description content;
[0030] A matching module, used for matching a corresponding target image generation model and a prompt word combination strategy based on the scene information;
[0031] A prompt word text construction module, used to construct a prompt word text by combining the description content and the prompt word combination strategy;
[0032] The image generation module is used to input the prompt word text into the target image generation model to obtain a target space image corresponding to the image generation requirement.
[0033] Optionally, the scene information includes: target style and target space type;
[0034] Optionally, the matching module includes:
[0035] The search submodule is used to search for the target image generation model corresponding to the target style; and search for the prompt word combination strategy matching the target space type according to the target space type.
[0036] Optionally, it further includes: a template construction module, which is used to pre-construct a first preset template corresponding to the space type based on the association relationship between the space type and the prompt word combination strategy;
[0037] Optionally, the acquisition module includes:
[0038] The template calling submodule is used to call the corresponding first preset template according to the target space type selected by the user for selection by the user;
[0039] The description content generation submodule is used to generate the description content based on the user selection result and in accordance with the order of each target prompt word in the first preset template and the attribute options of each target prompt word.
[0040] Optionally, the prompt word text construction module includes:
[0041] An extraction submodule, used to extract each target prompt word from the description content and determine the prompt attribute of each target prompt word;
[0042] A construction submodule, used to construct the prompt word text by combining the target prompt word and its prompt attribute and prompt word combination strategy;
[0043] The adjustment submodule is used to adjust the prompt word text according to the special instructions in the description content.
[0044] Optionally, the adjustment submodule includes:
[0045] A recognition unit, used for recognizing whether there is a special word in the short sentence where the target prompt word is located;
[0046] an optimization unit, configured to optimize the prompt word text based on the type of the special word if the special word exists;
[0047] The optimization unit comprises:
[0048] A first optimization unit is used to construct a first text when there is a positive special word in the short sentence where the target prompt word is located; the first text is used to represent the increase of the target weight of the target prompt word;
[0049] The second optimization unit is used to construct a second text when there is a negative special word in the short sentence where the target prompt word is located; the second text is used to represent the reduction of the target weight of the target prompt word.
[0050] Optionally, also include:
[0051] Model building module, used to build image training sets and image generation models, and determine the prompt word combination strategy;
[0052] A model training module, used for inputting the image training set into the corresponding image generation model for training, and determining a prompt word combination strategy for a corresponding space type;
[0053] The model training module includes:
[0054] The prompt word combination strategy construction submodule is used to identify the output image with the highest similarity to the historical image, and use the current weight of the prompt word corresponding to the output image as the target weight; use the current order of the prompt words corresponding to the output image as the target order, and combine the target weight and target order of the prompt words to construct the prompt word combination strategy.
[0055] This specification also provides an electronic device, wherein the electronic device includes:
[0056] processor; and,
[0057] A memory storing computer executable instructions, which when executed cause the processor to perform any of the above methods.
[0058] The present specification also provides a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, and when the one or more programs are executed by a processor, any of the above methods is implemented.
[0059] In the present application, the image generation requirements of the user are obtained; the image generation requirements include: scene information and description content; based on the scene information, the corresponding target image generation model and prompt word combination strategy are matched; combining the description content and the prompt word combination strategy, a prompt word text is constructed; the prompt word text is input into the target image generation model to obtain a target space image corresponding to the image generation requirement, so as to improve the fit between the generated image and the user's requirements and the efficiency of image generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 A schematic diagram of the principle of an image generation method for a public space provided in an embodiment of this specification;
[0061] Figure 2 A flowchart of a method for generating an image of a public space provided in an embodiment of this specification;
[0062] Figure 3 A schematic diagram of the structure of an image generation system for a public space provided in an embodiment of this specification;
[0063] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification;
[0064] Figure 5 A schematic diagram of a computer-readable medium provided in accordance with an embodiment of the present specification. DETAILED DESCRIPTION
[0065] The following description is used to disclose the present invention so that those skilled in the art can implement the present invention. The preferred embodiments described below are only examples, and those skilled in the art can think of other obvious variations. The basic principles of the present invention defined in the following description can be applied to other embodiments, variations, improvements, equivalents, and other technical solutions that do not deviate from the spirit and scope of the present invention.
[0066] Exemplary embodiments of the present invention will now be described more fully with reference to the accompanying drawings. However, exemplary embodiments can be implemented in a variety of forms, and should not be construed as limiting the present invention to the embodiments set forth herein. On the contrary, providing these exemplary embodiments enables the present invention to be more comprehensive and complete, and is more convenient for fully conveying the inventive concept to those skilled in the art. The same reference numerals in the figures represent the same or similar elements, components or parts, and thus their repeated description will be omitted.
[0067] Under the premise of being consistent with the technical concept of the present invention, the features, structures, characteristics or other details described in a specific embodiment do not exclude that they can be combined in one or more other embodiments in a suitable manner.
[0068] In the description of specific embodiments, the features, structures, characteristics or other details described in the present invention are intended to enable those skilled in the art to fully understand the embodiments. However, it does not exclude that those skilled in the art can practice the technical solutions of the present invention without one or more of the specific features, structures, characteristics or other details.
[0069] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0070] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0071] The term "and / or" or "and / or" includes all combinations of any one or more of the associated listed items.
[0072] Figure 1 A schematic diagram of a method for generating an image of a public space provided in an embodiment of this specification, the method comprising:
[0073] S2 obtains the user's image generation requirements; the image generation requirements include: scene information and description content;
[0074] S3 matches the corresponding target image generation model and prompt word combination strategy based on the scene information;
[0075] S4 combines the description content and the prompt word combination strategy to construct a prompt word text;
[0076] S5: input the prompt word text into the target image generation model to obtain a target space image corresponding to the image generation requirement.
[0077] In the field of image generation in public spaces, the following problems exist in the model training of text-generated images:
[0078] (1) The training of many models relies on the user’s professional knowledge and skills, as well as long-term project experience, which significantly reduces the accuracy and efficiency of image generation.
[0079] (2) Due to the differences in word definitions and spatial descriptions used by different users, the model may produce different images for the same word when generating images. This increases the difficulty of secondary adjustments and also limits the fusion generation of multiple models.
[0080] (3) Due to insufficient model training, low data quality or unreasonable model design, images are prone to being blurred or incorrectly represented.
[0081] In order to solve the problem that the image of the public space output by the image generation model has a low matching degree with the image generation requirement, the present invention provides an image generation method for the public space, such as Figure 2 As shown, it specifically includes:
[0082] S1 builds image training sets and image generation models, and determines the prompt word combination strategy;
[0083] S11 presets several space types and several prompt words;
[0084] Space types include: public space, office space, hotel space, medical and nursing space, and transportation space.
[0085] Types of prompt words include: material element proportions, space size, image perspective, ceiling shape, and lamp shape.
[0086] Each type of prompt word includes several specific contents.
[0087] In one embodiment of the present specification, in the prompt words of the element proportion, the specific content of the prompt words includes: material type, location of the material, and proportion of the material in the historical image.
[0088] The specific contents of the space size prompts include: cantilevered hall and single-story hall,
[0089] In the prompt words of the image perspective, the specific contents of the prompt words include: local space and overall space.
[0090] The specific contents of the prompt words for the top surface shape include: curve, plane, rectangle, irregular, and regular arrangement.
[0091] In the prompt words of the lamp shape, the specific contents of the prompt words include: only line lights, only spot lights, and only surface lights.
[0092] The prompt attributes of the prompt word include: positive and negative.
[0093] Among them, positive prompt words refer to the elements or features that the user wants the model to include or emphasize when generating images. With each additional positive prompt word, the model will be more likely to generate images containing these elements.
[0094] Negative prompt words refer to elements or features that users do not want the model to include when generating images. With each additional negative prompt word, the model will be more likely to avoid generating images containing these elements.
[0095] S12 builds an image training set;
[0096] Specifically, S121 obtains a number of historical images;
[0097] Historical images should ensure high quality and high definition, avoid homogeneity and ensure diversity of materials.
[0098] S122 determines the training text based on the expression content of the historical image;
[0099] Determine the style of the historical image. Specifically, the style of the historical image can be determined based on the color, lines, etc. of the historical image. Alternatively, the style of each historical image can be marked based on manual processing; based on the marking result, the style of each historical image is determined.
[0100] Combined with the expression scenes of historical images, each historical image is labeled with its spatial type;
[0101] Identify the detail features in historical images and determine the prompt words and their prompt attributes in historical images; detail features include: colors, lines, etc. of people, plants, architectural details, activity scenes, etc.
[0102] The training text is obtained based on the prompt words and detail features.
[0103] S123 combines training text and preprocessed historical images to construct an image training set;
[0104] The historical images are preprocessed; in one embodiment of the present specification, each historical image is adjusted according to a preset size requirement.
[0105] Historical images of the same style are extracted, training samples are classified according to spatial types, and different image training sets are constructed.
[0106] That is to say, the training samples of the same spatial type under the same style are in the same image training set. By increasing the amount and diversity of training data, the generalization ability of the model is improved.
[0107] S13 builds an image generation model;
[0108] The input data of the image generation model is text, and the output data is an image. In one embodiment of the present specification, the image generation model is a Stable Diffusion model.
[0109] There are many types of Stable Diffusion models, each with its own unique functions and application scenarios. Users can choose the most suitable model according to their actual needs. The specific model types are not limited here.
[0110] Preferably, multiple image generation models can be pre-built according to the style of the generated images; and training parameters can be configured, including the number of training rounds, batch size, learning rate, etc.
[0111] Using multiple image training sets of corresponding styles, the image generation model is trained and parameters are adjusted respectively, so that higher resolution and higher quality images can be generated through careful prompt words and parameter adjustment. In one embodiment of the present specification, under the same style, training samples of the same space type in the image training set are input into the image generation model for training to determine the prompt word combination strategy corresponding to the space type.
[0112] In one embodiment of the present specification, the image generation model includes: a basic model and a fine-tuning model.
[0113] S14: inputting the image training set into the corresponding image generation model for training, and determining a prompt word combination strategy for the corresponding space type;
[0114] Among them, S141 randomly assigns a weight to each prompt word, which is used to determine the attention level of the prompt word.
[0115] S142 randomly determines the order of each prompt word.
[0116] S143 inputs the image training set into the basic model of the corresponding image generation model for training.
[0117] In one embodiment of this specification, S143 includes:
[0118] S143-A-1 determines whether to continue training based on the similarity between the output image and the historical image;
[0119] S143-A-2 If the similarity is less than or equal to the preset threshold, one or more of the model parameters, prompt word order, and prompt word weight are adjusted and training continues.
[0120] S143-A-3 When the similarity between the output image and the historical image is greater than the preset threshold, the current weight of the prompt word at this time is used as the target weight; the current order of the prompt words is used as the target order, and the prompt word combination strategy is constructed by combining the target weight and target order of the prompt words.
[0121] The weight of the prompt word refers to the weight of the prompt word corresponding to the prompt word. The order of the prompt word refers to the order of the prompt word corresponding to the prompt word. The higher the order of the prompt word, the higher its importance (weight).
[0122] In another embodiment of the present specification, S143 includes:
[0123] S143-B-1 generates a plurality of output images based on a preset adjustment strategy;
[0124] The preset adjustment strategy includes a first preset adjustment strategy, a second preset adjustment strategy, and a third preset adjustment strategy.
[0125] Among them, the first preset adjustment strategy includes: in the iterative process, switching prompt words based on a preset number of steps. The first preset adjustment strategy means that in the iterative process of image generation, the same prompt word is not always used, but the prompt word is switched according to a preset number of steps (step). For example, use [prompt1:prompt2:step] to switch prompt words at a specified number of steps, where prompt1 and prompt2 are two different prompt words, and step is the step interval for switching prompt words. When the iteration reaches the specified number of steps, the system will automatically switch from prompt1 to prompt2, or switch from prompt2 back to prompt1, and so on.
[0126] The second preset adjustment strategy includes: in the iteration process, the prompt words are used alternately in each step. The second preset adjustment strategy switches the prompt words more frequently, that is, different prompt words are used in each iteration. Specifically, the | symbol is used to separate different prompt words, for example, prompt1|prompt2. In this case, the system will use prompt1 in the first step, prompt2 in the second step, and then prompt1 again in the third step, and so on, to achieve the alternating use of prompt words.
[0127] The third preset adjustment strategy includes: alternating sampling. Specifically, each sampling step is assigned a corresponding prompt word or parameter to guide the model to generate an output that meets expectations at each step.
[0128] The present invention can determine the corresponding preset adjustment strategy according to actual needs. For example, in artistic creation, a sequence of images with varied styles or rich contents can be generated by switching prompt words. In scientific research, it can be used to explore the influence of different parameters and prompt words on image generation results. In commercial applications, multiple design solutions can be quickly generated for customers to choose from.
[0129] Through the above-mentioned method, the flexibility and diversity of image generation are improved, and the switching process of prompt words is automated through preset strategies, thereby reducing manual intervention.
[0130] S143-B-2 identifies the output image with the highest similarity to the historical image, takes the current weight of the prompt word corresponding to the output image as the target weight; takes the current order of the prompt words corresponding to the output image as the target order, and constructs the prompt word combination strategy by combining the target weight and target order of the prompt words. The earlier the order of the prompt word, the higher its importance (weight).
[0131] S143-B-3 establishes an association relationship between space type and prompt word combination strategy, wherein, in the same style, space type and prompt word combination strategy correspond one to one. Of course, that is to say, the association relationship may also include: style - space type - prompt word combination strategy.
[0132] The present invention provides clear prompt words and specifications so that users can obtain satisfactory image results more quickly, reduce the number of trial and error times, and improve generation efficiency.
[0133] In order to reduce the pollution of prompt words, during the training process, use BREAK in the Web UI to interrupt the connection between the previous and next prompt words.
[0134] S15 uses the fine-tuning model to fine-tune the image generation model;
[0135] The fine-tuning model is used as a patch of the base model, and the fine-tuning model is preferably a LoRa model. The LoRa model is used to customize the drawing content or style.
[0136] By selecting the appropriate model and Lora patch, users can customize the generated effect according to specific needs and improve the applicability of the model.
[0137] By continuously testing different prompt word combinations and parameter settings, the generated images can be optimized to improve the fit between the images and user needs.
[0138] S2 obtains the user's image generation requirements;
[0139] The user in this manual refers to the user.
[0140] The image generation requirements include: scene information and description content;
[0141] By obtaining image generation requirements, we can accurately understand the user's intentions and expectations and provide a clear direction for subsequent image generation.
[0142] In one embodiment of the present specification, the description content is an expression text input by a user.
[0143] In another embodiment of the present specification, obtaining scene information selected by a user;
[0144] Wherein, the scene information includes: target style and target space type;
[0145] Based on the association between the space type and the prompt word combination strategy, a first preset template corresponding to the space type is pre-built;
[0146] Specifically, the order of each type of prompt words is predetermined in combination with the prompt word combination strategy, and selection buttons are provided for the prompt words and attribute options.
[0147] According to the target space type selected by the user, a corresponding first preset template is retrieved for selection by the user;
[0148] Based on the user selection result, the description content is generated according to the order of each target prompt word in the first preset template and the attribute options of each target prompt word.
[0149] The present invention improves the efficiency of generating description content and ensures the accuracy and consistency of the description content through a standardized preset template.
[0150] S3 matches the corresponding target image generation model and prompt word combination strategy based on the scene information;
[0151] Among them, the target image generation model corresponding to the target style is searched; and according to the target space type, the prompt word combination strategy matching it is searched.
[0152] In order to improve the search efficiency, a model library is constructed based on the correspondence between the style and the image generation model in S1. According to the target style, the system searches for the corresponding target image generation model in the model library.
[0153] A strategy library is constructed based on the association between the space type and the prompt word combination strategy in S1. Each target image generation model corresponds to a strategy library. According to the identified space type, the system searches for a matching prompt word combination strategy in the strategy library.
[0154] The present invention matches different models and strategies according to different scene information, and is applicable to a variety of public space scenes, so as to generate images that meet the characteristics of the scenes. Through the above matching mechanism, the pertinence and accuracy of image generation are improved.
[0155] S4 combines the description content and the prompt word combination strategy to construct a prompt word text;
[0156] S41 extracts each target prompt word from the description content, and determines a prompt attribute of each target prompt word;
[0157] Combining the target prompt word and its prompt attribute and the prompt word combination strategy, constructing the prompt word text;
[0158] The cue word combination strategy includes: target order and target weight of cue words.
[0159] In one embodiment of this specification, S41 includes:
[0160] S41-A-1 normalizes the description content;
[0161] (1) Constructing a matching relationship of prompt words. Specifically, collect synonyms, antonyms, and translation texts of prompt words in other languages as auxiliary words, and establish a matching relationship between prompt words and auxiliary words.
[0162] (2) searching for auxiliary words in the description content using text recognition technology; if auxiliary words exist, replacing the auxiliary words with prompt words that match them and updating the description content;
[0163] (3) Using semantic recognition technology, search for synonymous sentences with the same meaning as the prompt word in the description content; if there are synonymous sentences, replace the synonymous sentences with the prompt word with the corresponding meaning and update the description content.
[0164] S41-A-2 searching for a prompt word in the description content, and if the prompt word exists in the description content, using the found prompt word as the target prompt word;
[0165] S41-A-3 searches for a negative word in the short sentence where the target prompt word is located. If so, the prompt word attribute of the target prompt word is determined to be negative.
[0166] S41-A-4 arranges the target prompt words according to the target order in the prompt word combination strategy, determines the target weight of each target prompt word based on the prompt word combination strategy, and constructs the prompt word text in combination with the prompt attribute of each target prompt word.
[0167] In another embodiment of the present specification, S41 includes:
[0168] A second preset template is provided, which includes several types of prompt words and attribute options; and a selection button is set for the user to select.
[0169] Based on the user selection result, the description content is generated. At this time, the description content directly includes a number of target prompt words and their prompt attributes.
[0170] Based on the description content and the prompt word combination strategy, the order and target weight of each target prompt word are determined, and the prompt word text is generated.
[0171] In another embodiment of the present specification, S41 includes:
[0172] Generate description content according to the user's selection in the first preset template and use the description content directly as prompt word text.
[0173] The present invention can reduce the computing resources and time required to generate an undesirable image by using effective prompt words.
[0174] S42 adjusts the prompt word text according to the special instructions in the description content.
[0175] In one embodiment of the specification, the description may also include special instructions.
[0176] S421 identifies whether there is a special word in the short sentence where the target prompt word is located;
[0177] The special words include positive special words and negative special words. Positive special words are used to increase the attention of a specific prompt word. Negative special words are used to reduce the attention of a specific prompt word.
[0178] S422: If the special word exists, optimizing the prompt word text based on the type of the special word, so as to adjust the target weight of the target prompt word.
[0179] Specifically, when there is a positive special word in the short sentence where the target prompt word is located, a first text is constructed; the first text is used to represent the increase in the target weight of the target prompt word;
[0180] When there are negative special words in the short sentence where the target prompt word is located, a second text is constructed; the second text is used to represent the reduction of the target weight of the target prompt word.
[0181] The first text and / or the second text are added to the prompt word text. Specifically, based on the first text, a first mark is added to the target prompt word in the prompt word text that needs to increase the target weight, and the first mark is a small bracket ();
[0182] Based on the second text, a second mark is added to the target prompt word in the prompt word text whose target weight needs to be reduced, and the second mark is a square bracket [].
[0183] The present invention can adjust the weight of prompt words based on special words, using different brackets and specific syntax, so as to accurately control the specific features and style of the image according to the description content.
[0184] The present invention combines the description content and the prompt word combination strategy to construct a personalized prompt word text, so that the generated image better meets the personalized needs of the user.
[0185] S5: input the prompt word text into the target image generation model to obtain a target space image corresponding to the image generation requirement.
[0186] After receiving the prompt word, the image generation model will perform reasoning and calculation based on its internally learned knowledge and algorithms to generate a target space image that conforms to the text description of the prompt word. Since the generated image is more in line with the user's personalized needs and scene characteristics, the present invention effectively improves the user's satisfaction and usage experience.
[0187] In practical applications, it may be necessary to iteratively adjust and optimize the prompt words and model parameters according to the generated image effects to obtain more satisfactory image results.
[0188] In one embodiment of the present specification, the prompt word may be in English.
[0189] The present invention is mainly used for image generation in public spaces, including indoor, landscape, architecture and other aspects.
[0190] The present invention accurately captures the user's image generation needs, including scene information and description content, and intelligently matches the most suitable image generation model and prompt word combination strategy. Combined with the user's description content, the corresponding prompt word text is constructed, and then the target image generation model is driven to efficiently generate a target space image that closely matches the user's needs, so that the user can design and plan public spaces based on the target space image.
[0191] Figure 3 A schematic diagram of a system for generating an image of a public space provided in an embodiment of this specification, the system comprising:
[0192] The acquisition module 320 is used to acquire the image generation requirements of the user; the image generation requirements include: scene information and description content;
[0193] A matching module 330, used for matching a corresponding target image generation model and a prompt word combination strategy based on the scene information;
[0194] A prompt word text construction module 340 is used to construct a prompt word text by combining the description content and the prompt word combination strategy;
[0195] The image generation module 350 is used to input the prompt word text into the target image generation model to obtain a target space image corresponding to the image generation requirement.
[0196] Optionally, the scene information includes: target style and target space type;
[0197] Optionally, the matching module 330 includes:
[0198] The search submodule is used to search for the target image generation model corresponding to the target style; and search for the prompt word combination strategy matching the target space type according to the target space type.
[0199] Optionally, it further includes: a template construction module, which is used to pre-construct a first preset template corresponding to the space type based on the association relationship between the space type and the prompt word combination strategy;
[0200] Optionally, the acquisition module 320 includes:
[0201] The template calling submodule is used to call the corresponding first preset template according to the target space type selected by the user for selection by the user;
[0202] The description content generation submodule is used to generate the description content based on the user selection result and in accordance with the order of each target prompt word in the first preset template and the attribute options of each target prompt word.
[0203] Optionally, the prompt word text construction module 340 includes:
[0204] An extraction submodule, used to extract each target prompt word from the description content and determine the prompt attribute of each target prompt word;
[0205] A construction submodule, used to construct the prompt word text by combining the target prompt word and its prompt attribute and prompt word combination strategy;
[0206] The adjustment submodule is used to adjust the prompt word text according to the special instructions in the description content.
[0207] Optionally, the adjustment submodule includes:
[0208] A recognition unit, used for recognizing whether there is a special word in the short sentence where the target prompt word is located;
[0209] an optimization unit, configured to optimize the prompt word text based on the type of the special word if the special word exists;
[0210] The optimization unit comprises:
[0211] A first optimization unit is used to construct a first text when there is a positive special word in the short sentence where the target prompt word is located; the first text is used to represent the increase of the target weight of the target prompt word;
[0212] The second optimization unit is used to construct a second text when there is a negative special word in the short sentence where the target prompt word is located; the second text is used to represent the reduction of the target weight of the target prompt word.
[0213] Optionally, also include:
[0214] Model building module, used to build image training sets and image generation models, and determine the prompt word combination strategy;
[0215] A model training module, used for inputting the image training set into the corresponding image generation model for training, and determining a prompt word combination strategy for a corresponding space type;
[0216] The model training module includes:
[0217] The prompt word combination strategy construction submodule is used to identify the output image with the highest similarity to the historical image, and use the current weight of the prompt word corresponding to the output image as the target weight; use the current order of the prompt words corresponding to the output image as the target order, and combine the target weight and target order of the prompt words to construct the prompt word combination strategy.
[0218] The functions of the system of the embodiment of the present invention have been described in the above method embodiment, so for details not fully described in this embodiment, please refer to the relevant description in the above embodiment, and no further description will be given here.
[0219] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0220] The electronic device embodiment of the present invention is described below, and the electronic device can be regarded as a physical implementation of the method and device embodiments of the present invention described above. The details described in the electronic device embodiment of the present invention should be regarded as a supplement to the above method or device embodiments; details not disclosed in the electronic device embodiment of the present invention can be implemented with reference to the above method or device embodiments.
[0221] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification. Figure 4 The computer device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0222] like Figure 4 As shown, the computer device 400 of this exemplary embodiment is in the form of a general data processing device. The components of the computer device 400 may include but are not limited to: at least one processor 410, at least one memory 420, a network interface 430, a display unit 440, an input component 450, etc.
[0223] The memory 420 stores a computer-readable program, which may be a source program or a code of a read-only program. The program may be executed by the processor 410, so that the processor 410 performs the steps of various embodiments of the present invention. For example, the processor 410 may perform the following steps: Figure 1 Steps shown.
[0224] The memory 420 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) and / or a cache memory unit, and may further include a read-only memory unit (ROM). The memory 420 may also include a program / utility having a set (at least one) of program modules, such program modules including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include the implementation of a network environment.
[0225] Also included is a bus (not shown) which may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0226] The computer device 400 may also communicate with one or more external devices (e.g., keyboard, display, network device, Bluetooth device, etc.) so that a user can interact with the computer device 400 via these external devices, and / or so that the computer device 400 can communicate with one or more other data processing devices (e.g., routers, modems, etc.). Such communication may be performed through the network interface 430, and may also be performed through a network adapter with one or more networks (e.g., local area network (LAN), wide area network (WAN) and / or public network, such as the Internet). The network adapter may communicate with other modules of the computer device 400 via a bus. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in the computer device 400, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0227] Figure 5 Schematic diagram of a computer readable medium embodiment of the present invention. Figure 5 As shown, the computer program can be stored on one or more computer-readable media. The computer-readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. When the computer program is executed by one or more data processing devices, the computer-readable medium is enabled to implement the above method of the present invention.
[0228] Through the description of the above implementation modes, it is easy for those skilled in the art to understand that the exemplary embodiments described in the present invention can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation mode of the present invention can be embodied in the form of a software product, which can be stored in a computer-readable storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a data processing device (which can be a personal computer, a server, or a network device, etc.) to perform the above method according to the present invention.
[0229] The computer readable storage medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by an instruction execution system, an apparatus, or a device or used in combination with it. The program code contained on the readable storage medium may be transmitted with any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.
[0230] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0231] In summary, the present invention can be implemented by a method, apparatus, electronic device or computer-readable medium that executes a computer program. In practice, a general data processing device such as a microprocessor or a digital signal processor (DSP) can be used to implement some or all functions of the present invention.
[0232] The specific embodiments described above further describe the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the present invention is not inherently related to any specific computer, virtual device or electronic device, and various general devices can also implement the present invention. The above description is only a specific embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for generating an image of a public space, characterized in that: include: Obtain the user's image generation requirements; The image generation requirements include: scene information and description content; Based on the scene information, matching the corresponding target image generation model and prompt word combination strategy; Combining the description content with the prompt word combination strategy, constructing a prompt word text; The prompt word text is input into the target image generation model to obtain a target space image corresponding to the image generation requirement.
2. The method for generating an image for a public space according to claim 1, characterized in that: The scene information includes: target style and target space type; The matching of the corresponding target image generation model and prompt word combination strategy based on the scene information includes: The target image generation model corresponding to the target style is searched; and according to the target space type, the prompt word combination strategy matching it is searched.
3. The method for generating an image for a public space according to claim 2, characterized in that: Also includes: Based on the association between the space type and the prompt word combination strategy, a first preset template corresponding to the space type is pre-built; The obtaining of the user's image generation requirement includes: According to the target space type selected by the user, a corresponding first preset template is retrieved for selection by the user; Based on the user selection result, the description content is generated according to the order of each target prompt word in the first preset template and the attribute options of each target prompt word.
4. The method for generating an image for a public space according to claim 1, characterized in that: The step of combining the description content with the prompt word combination strategy to construct a prompt word text includes: Extracting each target prompt word from the description content, and determining a prompt attribute of each target prompt word; Combining the target prompt word and its prompt attribute and the prompt word combination strategy, constructing the prompt word text; The prompt word text is adjusted according to the special instructions in the description content.
5. The method for generating an image for a public space according to claim 4, characterized in that: The step of adjusting the prompt word text according to the special instructions in the description content includes: Identify whether there is a special word in the short sentence where the target prompt word is located; If the special word exists, the prompt word text is optimized based on the type of the special word, wherein, when there is a positive special word in the short sentence where the target prompt word is located, a first text is constructed; the first text is used to represent an increase in the target weight of the target prompt word; when there is a negative special word in the short sentence where the target prompt word is located, a second text is constructed; the second text is used to represent a decrease in the target weight of the target prompt word.
6. The method for generating an image for a public space according to claim 1, characterized in that: Also includes: Construct image training sets and image generation models, and determine the prompt word combination strategy; The image training set is input into the corresponding image generation model for training, and the prompt word combination strategy of the corresponding space type is determined; wherein, the output image with the highest similarity to the historical image is identified, and the current weight of the prompt word corresponding to the output image is used as the target weight; The current order of the prompt words corresponding to the output image is taken as the target order, and the prompt word combination strategy is constructed by combining the target weight and the target order of the prompt words.
7. An image generation system for a public space, characterized in that: include: An acquisition module is used to obtain the user's image generation requirements; The image generation requirements include: scene information and description content; A matching module, used for matching a corresponding target image generation model and a prompt word combination strategy based on the scene information; A prompt word text construction module, used to construct a prompt word text by combining the description content and the prompt word combination strategy; The image generation module is used to input the prompt word text into the target image generation model to obtain a target space image corresponding to the image generation requirement.
8. An electronic device, wherein: The electronic device includes: processor; and, A memory storing computer executable instructions which, when executed, cause the processor to perform the method according to any one of claims 1-6.
9. A computer-readable storage medium, wherein: The computer-readable storage medium stores one or more programs, and when the one or more programs are executed by a processor, the method of any one of claims 1 to 6 is implemented.
Citation Information
Cited By
Method, system and device for generating e-commerce picture according to picture requirement and storage medium
CN121527234A
Image generation method and device, electronic equipment and storage medium
CN122176079A
An image generation method, apparatus, electronic device, and storage medium
CN122176079B
Image analysis method, device, equipment, storage medium and program product
CN122637169A
Image analysis method, device, equipment, storage medium and program product
CN122637169B