A method, apparatus, and electronic device for generating object sample images.

By using attribute dimension vocabulary and logical verification conditions to generate prompt statements in object sample image generation, and combining this with image quality assessment, the problem of low efficiency in prompt text generation is solved, thus improving the efficiency and quality of face image generation.

CN119784867BActive Publication Date: 2026-03-13BEIJING LUCHEN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing technologies suffer from low efficiency in generating prompt text, and lack richness, complexity, and diversity, resulting in low efficiency and poor quality in generating face image samples.

Method used

The system determines the prompt statement to be applied based on at least one first candidate word corresponding to a first attribute dimension, at least one second candidate word corresponding to a second attribute dimension, and statement logic verification conditions. It then uses a pre-trained object sample image generation model to generate candidate object sample images and combines an image quality assessment mechanism to determine the target object sample image.

Benefits of technology

It improves the efficiency and richness of prompt statement generation, enhances the efficiency and quality of object sample image generation, and ensures that the generated image quality meets the standards.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119784867B_ABST
    Figure CN119784867B_ABST
Patent Text Reader

Abstract

This invention provides a method, apparatus, and electronic device for generating object sample images. The method includes: determining a prompt statement to be applied based on at least one first candidate word of a first attribute dimension, at least one second candidate word of a second attribute dimension, and a statement logic check condition; generating at least one candidate object sample image based on the prompt statement to be applied and a pre-trained object sample image generation model; performing image quality evaluation on each candidate object sample image to obtain an image quality score corresponding to each candidate object sample image, and determining the target object sample image based on the image quality score. This improves the efficiency of prompt statement generation, enhances the richness, complexity, and diversity of prompt statements, and thus improves the generation efficiency and image quality of object sample images. Furthermore, the image quality evaluation mechanism further improves the image quality of the object sample images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of information processing technology, and in particular to a method, apparatus and electronic device for generating object sample images. Background Technology

[0002] Large-scale artificial intelligence models (such as face processing models) are widely used in various industries, requiring large and rich datasets of face images as training data to improve their performance. One method for generating face image data is to input descriptive prompts into a text-image joint model to obtain target face images that match the prompts. The quality and diversity of the target face images generated by this technique largely depend on the prompt text.

[0003] Currently, the main methods for determining prompt text are: prompt text generation methods based on fixed templates and prompt text generation methods relying on manual editing. However, the first method, due to its fixed structure and limited descriptive dimensions, generates prompt text lacking richness, thus limiting the expressiveness and diversity of the generated images. The second method requires a large amount of manpower, is extremely inefficient, and generates prompt text of inconsistent quality, making it difficult to support large-scale generation tasks. Therefore, the problems of low prompt text generation efficiency, lack of richness, complexity, and diversity in prompt text lead to low efficiency and poor quality in generating face image samples. Summary of the Invention

[0004] This invention provides a method, apparatus, and electronic device for generating object sample images to improve the efficiency of prompt statement generation, enhance the richness, complexity, and diversity of prompt statements, thereby improving the generation efficiency and image quality of object sample images. Furthermore, an image quality scoring mechanism is used to evaluate the image quality of the generated object sample images to obtain object sample images that meet the image quality standards, further improving the image quality of the object sample images.

[0005] In a first aspect, embodiments of the present invention provide a method for generating object sample images, the method comprising:

[0006] Based on at least one first candidate word corresponding to a first attribute dimension, at least one second candidate word corresponding to a second attribute dimension, and statement logic verification conditions, a prompt statement to be applied is determined; wherein, the first attribute dimension is a mandatory attribute dimension when generating the prompt statement to be applied, and the second attribute dimension is an optional attribute dimension when generating the prompt statement to be applied.

[0007] Based on the prompt statement to be applied and the pre-trained object sample image generation model, at least one candidate object sample image is generated.

[0008] Image quality is evaluated on the at least one candidate object sample image to obtain an image quality score corresponding to the at least one candidate object sample image, and the target object sample image is determined based on the image quality score.

[0009] Secondly, embodiments of the present invention also provide an object sample image generation apparatus, the apparatus comprising:

[0010] The prompt statement determination module is used to determine the prompt statement to be applied based on at least one first candidate word corresponding to at least one first attribute dimension, at least one second candidate word corresponding to at least one second attribute dimension, and statement logic verification conditions; wherein, the first attribute dimension is a mandatory attribute dimension when generating the prompt statement to be applied, and the second attribute dimension is an optional attribute dimension when generating the prompt statement to be applied.

[0011] The sample image generation module is used to generate at least one candidate object sample image based on the prompt statement to be applied and the pre-trained object sample image generation model.

[0012] The sample image screening module is used to evaluate the image quality of the at least one candidate object sample image, obtain the image quality score corresponding to the at least one candidate object sample image, and determine the target object sample image based on the image quality score.

[0013] Thirdly, embodiments of the present invention also provide an electronic device, the electronic device comprising:

[0014] One or more processors;

[0015] A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the object sample image generation method as described in any embodiment of the present invention.

[0016] Fourthly, embodiments of the present invention also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the object sample image generation method as described in any of the embodiments of the present invention.

[0017] The technical solution of this invention determines the prompt statement to be applied by using at least one first candidate word corresponding to a first attribute dimension, at least one second candidate word corresponding to a second attribute dimension, and statement logic verification conditions. The first attribute dimension is a mandatory attribute dimension when generating the prompt statement, and the second attribute dimension is an optional attribute dimension. Then, based on the prompt statement and a pre-trained object sample image generation model, at least one candidate object sample image is generated. The image quality of the at least one candidate object sample image is then evaluated to obtain an image quality score corresponding to the at least one candidate object sample image, and the target object sample image is determined based on the image quality score. This embodiment, under the constraint of statement logic verification conditions, automatically generates prompt statements by randomly combining words in the mandatory and optional attribute dimensions, improving the generation efficiency, richness, complexity, and diversity of prompt statements. This, in turn, improves the generation efficiency and image quality of object sample images. Furthermore, the image quality score mechanism evaluates the generated object sample images to obtain object sample images that meet the image quality standards, further improving the image quality of the object sample images. Attached Figure Description

[0018] To more clearly illustrate the technical solutions of exemplary embodiments of the present invention, the accompanying drawings used in describing the embodiments are briefly introduced below. Obviously, the accompanying drawings described are only a portion of the drawings of the embodiments to be described in this invention, and not all of the drawings. For those skilled in the art, other drawings can be obtained from these drawings without any creative effort.

[0019] Figure 1 A flowchart illustrating an object sample image generation method provided in an embodiment of the present invention;

[0020] Figure 2 A flowchart illustrating another object sample image generation method provided in an embodiment of the present invention;

[0021] Figure 3 A flowchart illustrating another object sample image generation method provided in an embodiment of the present invention;

[0022] Figure 4 This is a schematic diagram of the structure of an object sample image generation device provided in an embodiment of the present invention;

[0023] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0024] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.

[0025] Example 1

[0026] Figure 1 This is a flowchart illustrating an object sample image generation method provided in an embodiment of the present invention. This embodiment is applicable to any situation where object sample images need to be generated. The method can be executed by an object sample image generation device, which can be implemented in the form of software and / or hardware. The hardware can be an electronic device, such as a mobile terminal, a PC, or a server.

[0027] like Figure 1 As shown, the method for generating the object sample image includes:

[0028] S110. Based on the first candidate words corresponding to at least one first attribute dimension, the second candidate words corresponding to at least one second attribute dimension, and the statement logic check conditions, determine the prompt statement to be applied.

[0029] The first attribute dimension is a mandatory attribute dimension when generating the tooltip. It is essential for generating the tooltip. The first candidate vocabulary refers to the words included in each of the first attribute dimensions. The second attribute dimension is an optional attribute dimension when generating the tooltip. In other words, the second attribute dimension is optional when generating the tooltip. The purpose of setting a second attribute dimension is to increase the diversity of the tooltip. The second candidate vocabulary refers to the words included in each of the second attribute dimensions.

[0030] Specifically, the first attribute dimension can be a basic attribute dimension of the object. For example, the first attribute dimension can include at least one of the following: age dimension, gender dimension, and occupation dimension. The first candidate words for the age dimension can be represented as: {Age dimension: “Infant”, “Teenager”, “Young Adult”, “Middle-aged”, “Elderly”}; the first candidate words for the gender dimension can be represented as: {Gender dimension: “Male”, “Female”}; the first candidate words for the occupation dimension can be represented as: {Occupation dimension: “Doctor”, “Scientist”, “Teacher”, etc.}.

[0031] The second attribute dimension includes at least one of the following: image background dimension, object emotion dimension, and object special marker dimension. The image background dimension characterizes the background information contained in the generated object sample image. For example, the second candidate words corresponding to the image background dimension could be represented as: {Image background dimension: “busy city”, “quiet forest”, “futuristic city”, etc.}. The object emotion dimension characterizes the emotion of the object contained in the generated object sample image. For example, the second candidate words corresponding to the object emotion dimension could be represented as: {Object emotion dimension: “smiling”, “focused”, “excited”, etc.}. The object special marker dimension characterizes the distinctive information of the object contained in the generated object sample image. For example, the second candidate words corresponding to the object special marker dimension could be represented as: {Object special marker dimension: “facial scar”, “earring”, “headscarf”, etc.}.

[0032] The statement logic test conditions are pre-defined rules used to check whether the statements composed of selected words conform to actual objective laws. For example, statement logic test conditions may include the reasonableness test conditions for statements combining age and occupation. For instance, statements stating that an "infant's" occupation is "doctor" and another stating that an "infant's" occupation is "scientist" do not meet the reasonableness test conditions for statements combining age and occupation because an "infant" cannot be a "doctor".

[0033] The prompt text to be applied refers to the prompt text that will be used to generate sample images of the target object. The prompt text is a piece of text input to the model, designed to guide the model in generating output with specific content or following a specific context. The prompt text can be a sentence, a question, a description, or any information that provides the necessary context and topic for generation.

[0034] It is understood that the technical solution provided in this embodiment is executed cyclically, meaning that the current iteration of the loop is in progress. In other words, the object sample image generation method provided in this embodiment can be used to obtain a large number of target object sample images, and a portion of the target object sample images can be obtained after each iteration is completed.

[0035] Specifically, the implementation method for determining the prompt statement to be applied can be as follows: Multiple candidate words corresponding to each first attribute dimension are respectively formed into a mandatory attribute pool. Then, a first candidate word can be randomly selected from the mandatory attribute pools corresponding to each first attribute dimension. Multiple candidate words corresponding to each second attribute dimension are respectively formed into a random attribute pool. Based on this, at least one target random attribute pool is first determined from each random attribute pool. Then, a second candidate word is randomly selected from each target random attribute pool. Further, the selected first and second candidate words are determined as target words. These target words are used to construct a complete sentence that conforms to grammatical logic. The logical rationality of this complete sentence is checked through a statement logic check condition. If the check passes, this complete sentence is determined as the corresponding prompt statement to be applied.

[0036] For example, for the first attribute dimension, the target words selected from the age dimension are "young people", the target words selected from the gender dimension are "women", and the target words selected from the occupation dimension are "doctors". For the second attribute dimension, the target words selected from the image background dimension are "futuristic technology city" and the target words selected from the object's emotion dimension are "smiling". Then the corresponding prompt statement to be applied can be expressed as "a young female doctor, with a futuristic technology city background and a smiling face".

[0037] S120. Based on the prompt statement to be applied and the pre-trained object sample image generation model, generate at least one candidate object sample image.

[0038] The object sample image generation model is a pre-trained image generation model used to generate at least one object sample image that matches the prompt text. For example, the object sample image generation model can employ the Flux model, which is trained on a large-scale dataset and possesses the ability to generate high-quality images. The Flux model is based on a diffusion model architecture and can generate high-quality, detailed images. The Flux model exhibits excellent performance in terms of diversity and generation quality, and is particularly suitable for generating images with complex backgrounds and detailed facial features. An object sample image refers to an image containing the object. Candidate object sample images refer to object sample images that require further selection.

[0039] In this embodiment, the prompt statement to be applied can be used as input to the object sample image generation model. The object sample image generation model generates at least one candidate object sample image corresponding to the prompt statement through its internal text-image alignment mechanism. It should be noted that the number of candidate object sample images can be one or more. This can be achieved by setting image quantity-related configuration parameters in the object sample image generation model according to user needs, so that the number of candidate object sample images output by the object sample image generation model matches the configuration parameters.

[0040] S130. Perform image quality assessment on at least one candidate object sample image to obtain an image quality score corresponding to the at least one candidate object sample image, and determine the target object sample image based on the image quality score.

[0041] The image quality score refers to a quantitative score that characterizes the quality of the candidate object sample image. For example, a higher image quality score indicates better image quality, while a lower score indicates worse image quality. The target object sample image refers to the object sample image whose image quality meets the requirements after filtering the candidate object sample images based on their image quality scores.

[0042] Specifically, image quality can be assessed using pre-defined image quality assessment methods for candidate object sample images, resulting in an image quality score for each candidate object sample image. Based on this, object sample images that meet the image quality requirements can be selected from the candidate object sample images according to the numerical value of the image quality scores corresponding to each candidate object sample image; these object sample images are the corresponding target object sample images.

[0043] Optionally, the specific implementation of determining the target object sample image based on the image quality score may include: determining the candidate object sample image with an image quality score greater than or equal to a preset quality score threshold as the target object sample image.

[0044] The preset quality score threshold is a pre-set image quality score threshold used to determine whether the image quality of the candidate sample image meets the quality requirements.

[0045] In this embodiment, for each candidate object sample image, a preset quality score threshold can be used to determine whether a candidate object sample image can be used as a target object sample image. Specifically, for a candidate object sample image, if the image quality score of the candidate object sample image is greater than or equal to the preset quality score threshold, it can be determined as the corresponding target object sample image. Otherwise, the candidate object sample image is discarded.

[0046] The technical solution of this invention determines the prompt statement to be applied by using at least one first candidate word corresponding to a first attribute dimension, at least one second candidate word corresponding to a second attribute dimension, and statement logic verification conditions. The first attribute dimension is a mandatory attribute dimension when generating the prompt statement, and the second attribute dimension is an optional attribute dimension. Then, based on the prompt statement and a pre-trained object sample image generation model, at least one candidate object sample image is generated. The image quality of the at least one candidate object sample image is then evaluated to obtain an image quality score corresponding to the at least one candidate object sample image, and the target object sample image is determined based on the image quality score. This embodiment, under the constraint of statement logic verification conditions, automatically generates prompt statements by randomly combining words in the mandatory and optional attribute dimensions, improving the generation efficiency, richness, complexity, and diversity of prompt statements. This, in turn, improves the generation efficiency and image quality of object sample images. Furthermore, the image quality score mechanism evaluates the generated object sample images to obtain object sample images that meet the image quality standards, further improving the image quality of the object sample images.

[0047] Example 2

[0048] Figure 2 This is a flowchart illustrating a method for generating object sample images according to Embodiment 2 of the present invention. Based on the foregoing embodiments, steps S110 and S130 are further refined. For detailed implementation methods, please refer to the detailed description of the embodiments disclosed herein. Technical features that are the same as or similar to those in the foregoing embodiments will not be repeated here.

[0049] like Figure 2 As shown, the method for generating the object sample image includes:

[0050] S210. For each first attribute dimension, randomly select a first target word from all the first candidate words of the first attribute dimension.

[0051] The first target vocabulary refers to the vocabulary selected from the vocabulary of the first attribute dimension.

[0052] In this embodiment, a first candidate word can be randomly selected from each first candidate word in each first attribute dimension as the first target word. Based on this, the first target word corresponding to each first attribute dimension can be obtained.

[0053] S220. Based on the probability value corresponding to each second attribute dimension, determine at least one target second attribute dimension from at least one second attribute dimension, so as to randomly select a second target word from each target second attribute dimension.

[0054] The second target vocabulary refers to the vocabulary selected from each vocabulary in the second attribute dimension.

[0055] In this embodiment, different probability values ​​can be pre-configured for each second attribute dimension. Therefore, in each iteration, one or more target second attribute dimensions are selected from all the second attribute dimensions based on the probability values ​​corresponding to each second attribute dimension. Furthermore, a second candidate word can be randomly selected from each second candidate word of each target second attribute dimension as the second target word. Based on this, the second target word corresponding to each target second attribute dimension can be obtained.

[0056] S230. Based on the first target vocabulary, the second target vocabulary, and the statement logic verification conditions, determine the prompt statement to be applied.

[0057] In this embodiment, the first target vocabulary and the second target vocabulary are first combined to construct at least one prompt statement to be filtered. Then, the prompt statement to be filtered is logically checked according to the statement logic check conditions. If the check passes, the prompt statement to be applied is obtained.

[0058] In this embodiment, a combination of rule-driven and random mechanisms is used to generate application prompts that meet the description requirements from a multi-dimensional attribute vocabulary. The first attribute dimension is the core component in generating application prompts; the second attribute dimension (such as mood, background, special markers, etc.) are random options to enhance the diversity of application prompts. Each time an application prompt is generated, mandatory attributes are selected according to rules, while a portion of random attributes are randomly selected and combined to ensure that the application prompts have high complexity and diversity while maintaining logical consistency.

[0059] Specifically, based on the first target vocabulary, the second target vocabulary, and the statement logic verification conditions, determining the specific implementation method of the prompt statement to be applied may include the following steps:

[0060] S1. Based on the sentence generation model, combine and assemble each first target word and each second target word to construct at least one prompt sentence to be filtered.

[0061] In this embodiment, a sentence generation model can be pre-trained. Based on obtaining each first target word and at least one second target word, these target words can be input into the sentence generation model. The sentence generation model can analyze and process these target words to obtain more related words similar to the target words. Thus, by combining and assembling these target words and / or related words, one or more prompt sentences to be filtered can be obtained.

[0062] S2. For each prompt statement to be filtered, perform a logical check on the prompt statement to be filtered based on the statement logical check conditions, and determine the logical consistency result.

[0063] The logical consistency result is used to characterize whether a query statement conforms to normal logic. The logical consistency result includes logically consistent results and logically inconsistent results.

[0064] In this embodiment, each of the prompt statements to be filtered can be logically checked by pre-set logical check conditions, thereby determining the logical consistency result corresponding to each prompt statement to be filtered.

[0065] S3. Based on the syntax verification model, perform syntax compliance verification on the statement to be filtered and determine the syntax compliance result.

[0066] The grammar compliance result indicates whether a given prompt statement conforms to normal grammatical structure. The grammar compliance result includes both grammar compliant and grammar non-compliant results.

[0067] In this embodiment, a grammar check model can be pre-trained. Each prompt statement to be filtered can be input into the grammar check model, which will perform grammar compliance checks on these prompt statements and obtain the grammar compliance result corresponding to each prompt statement to be filtered.

[0068] S4. Based on the logical consistency and grammatical compliance results of each prompt statement to be filtered, determine the prompt statement to be applied from each prompt statement to be filtered.

[0069] In this embodiment, the processing procedure for each suggestion statement to be filtered is consistent, and we will take any one of them as an example for explanation. For any suggestion statement to be filtered, if the logical consistency result of the suggestion statement to be filtered is logically consistent and the syntax compliance result is syntax compliant, then it can be determined as a suggestion statement to be applied. If the logical consistency result of the suggestion statement to be filtered is logically inconsistent and / or the syntax compliance result is syntax non-compliant, then the suggestion statement to be filtered is rejected.

[0070] It should be noted that the final number of application prompts can be 0, 1, or more. If there are 0 application prompts, S210-S230 are executed again. If there is 1 application prompt, S240-S290 can be executed to obtain the target object sample image corresponding to this application prompt. If there are multiple application prompts, S240-S290 can be executed multiple times to obtain the target object sample image for each application prompt.

[0071] S240. Based on the prompt statement to be applied and the pre-trained object sample image generation model, generate at least one candidate object sample image.

[0072] S250. For each candidate object sample image, perform aesthetic quality assessment processing on the candidate object sample image based on the aesthetic quality assessment model to obtain the image aesthetic quality score corresponding to the candidate object sample image.

[0073] The aesthetic quality assessment model is a pre-trained model used to evaluate the aesthetic quality of candidate sample images. The image aesthetic quality score characterizes the degree of beauty of the candidate sample image; for example, a higher image aesthetic quality score indicates a higher degree of beauty, and a lower score indicates a lower degree of beauty.

[0074] In this embodiment, the processing procedure for each candidate object sample image is consistent. Here, we will use any one candidate object sample image as an example for explanation. The candidate object sample image can be input into the aesthetic quality assessment model. The aesthetic quality assessment model performs image aesthetic quality assessment on the candidate object sample image and outputs an image aesthetic quality score corresponding to the candidate object sample image.

[0075] S260. Based on the face detection model, perform object detection processing on the sample image of the candidate object to obtain the face detection result corresponding to the sample image of the candidate object.

[0076] The face detection model is a pre-trained model used to detect whether a candidate object sample image contains facial image content. The face detection result can include detected faces and undetected faces.

[0077] In this embodiment, the candidate object sample image can be input into the face detection model. The face detection model performs face detection processing on the candidate object sample image and can output the face detection result corresponding to the candidate object sample image.

[0078] S270. Determine the text-image correlation score between the sample image of the candidate object and the prompt statement to be applied.

[0079] Among them, the text-image relevance score is used to characterize the degree of relevance between the candidate sample image and the prompt statement to be applied. For example, the higher the relevance score, the higher the degree of relevance between the candidate sample image and the prompt statement to be applied, and the lower the relevance score, the lower the degree of relevance between the candidate sample image and the prompt statement to be applied.

[0080] In this embodiment, the text-image relevance score can be determined using a multimodal pre-trained neural network model (Contrastive Language-Image Pre-training, CLIP model). Specifically, the candidate object sample image and the prompt statement to be applied can be input into the CLIP model, which can then output the text-image relevance score.

[0081] S280. Based on the image aesthetic quality score, face detection results, and text-image correlation score, determine the image quality score corresponding to each candidate object sample image.

[0082] In this embodiment, for each candidate object sample image, the corresponding image quality score can be determined by a comprehensive result of multiple factors, including image aesthetic quality score, face detection results, and text-image correlation score.

[0083] Specifically, the method for determining the image quality score corresponding to each candidate object sample image based on the image aesthetic quality score, face detection results, and text-image correlation score can include: for each candidate object sample image, if the face detection result is that no face result is detected, then the image quality score corresponding to the candidate object sample image is the lowest quality score; if the face detection result is that a face result is detected, then the image quality score corresponding to the candidate object sample image is determined based on the image aesthetic quality score and the text-image correlation score.

[0084] In this embodiment, for a candidate sample image, if the face detection result of this candidate sample image is "no face detected," such an image needs to be removed. Therefore, the image quality score corresponding to this candidate sample image can be set to 0. Specifically, a lower limit for aesthetic quality score and a lower limit for relevance score can be preset. If the aesthetic quality score of a candidate sample image is lower than the lower limit for aesthetic quality score, and / or the text-image relevance score is lower than the lower limit for relevance score, such an image also needs to be removed. Besides the above two cases, if the face detection result is "face detected," the image aesthetic quality score exceeds the lower limit for aesthetic quality score, and the text-image relevance score exceeds the lower limit for relevance score, the weighted sum of the image aesthetic quality score and the text-image relevance score can be determined as the image quality score corresponding to the candidate sample image.

[0085] In this embodiment, a three-layer quality assessment mechanism—aesthetic quality score, face detection, and semantic consistency check—automatically filters generated images. This multi-layered quality control method not only eliminates low-quality data that does not meet the requirements, ensuring that each generated sample image contains a clear face that conforms to semantic description, but also ensures the high quality and high relevance of images in the dataset. This targeted optimization significantly improves the usability and consistency of the dataset.

[0086] S290. Determine the target object sample image from each candidate object sample image based on the image quality score.

[0087] The technical solution of this embodiment, when determining the prompt statement to be applied, randomly selects a first target word from each first candidate word in each first attribute dimension; based on the probability value corresponding to each second attribute dimension, at least one target second attribute dimension is determined from each second attribute dimension, and a second target word is randomly selected from each target second attribute dimension; based on the first target word, the second target word, and the statement logic verification conditions, the prompt statement to be applied is determined. In the technical solution provided by this embodiment, the first attribute dimension is a core component in generating the prompt statement to be applied; the second attribute dimension is a random option to enhance the diversity of the prompt statement to be applied. Each time a prompt statement to be applied is generated, mandatory attributes are selected according to rules, and some random attributes are randomly selected and combined to ensure that the prompt statement to be applied has high complexity and diversity while maintaining logical consistency. By combining rule-driven and random mechanisms, a prompt statement to be applied that meets the description requirements is generated from multi-dimensional attribute words. Furthermore, by designing a three-layer quality assessment mechanism—aesthetic quality score, face detection, and semantic consistency check—generated images are automatically filtered. This multi-layered quality control method not only eliminates low-quality data that does not meet the requirements, ensuring that each generated sample image contains a clear face that conforms to semantic description, but also ensures the high quality and high relevance of images in the dataset. This targeted optimization significantly improves the usability and consistency of the dataset.

[0088] Example 3

[0089] Figure 3 This is a flowchart illustrating an object sample image generation method according to Embodiment 3 of the present invention. Based on the foregoing embodiments, when the cumulative number of target object sample images exceeds a threshold for the number of sample images, an object image sample dataset is obtained. Then, an object image processing model is trained based on the object image sample dataset. For detailed implementation methods, please refer to the detailed description of the embodiments in this disclosure. Technical features that are the same as or similar to those in the foregoing embodiments will not be repeated here.

[0090] like Figure 3 As shown, the method for generating the object sample image includes:

[0091] S310. Based on at least one first candidate word corresponding to a first attribute dimension, at least one second candidate word corresponding to a second attribute dimension, and statement logic verification conditions, determine the prompt statement to be applied.

[0092] S320. Based on the prompt statement to be applied and the pre-trained object sample image generation model, generate at least one candidate object sample image.

[0093] S330. Perform image quality assessment on at least one candidate object sample image to obtain an image quality score corresponding to the at least one candidate object sample image, and determine the target object sample image based on the image quality score.

[0094] S340. Determine whether the cumulative number of sample images of the target object exceeds the threshold for the number of sample images.

[0095] Among them, the sample image number threshold is used to determine whether the target object sample images can be stopped from the loop iteration.

[0096] In this embodiment, a threshold for the number of sample images can be preset. After obtaining the target object sample images in each loop, it can be determined whether the cumulative number of target object sample images exceeds the threshold for the number of sample images. If yes, then S350-S360 can be executed; if no, then S310-S340 can be executed repeatedly.

[0097] S350. If so, construct an object image sample dataset based on the sample images of each target object.

[0098] In this embodiment, the set of all generated target object sample images can be defined as the object image sample dataset.

[0099] S360. Train the object image processing model based on the object image sample dataset.

[0100] The object image processing model can be any model that needs to be trained based on an image containing an object.

[0101] In this embodiment, based on the obtained object image sample dataset, the object image sample dataset can be applied to any scenario where the object image processing model needs to be trained.

[0102] Based on the above embodiments, optionally, if the image quality scores of the target object sample images obtained in multiple iterations are all less than the preset quality score threshold, a prompt message is provided so that the user can adjust the sample image generation basis information based on the prompt message; after the sample image generation basis information is adjusted, the steps of determining the prompt statement to be applied, generating at least one candidate object sample image, and determining the target object sample image based on the image quality score are repeated.

[0103] The sample image generation is based on at least one of the following: a first attribute dimension, a second attribute dimension, a first candidate word corresponding to the first attribute dimension, at least one second candidate word corresponding to the second attribute dimension, and a preset logical verification condition. The prompt information refers to the content indicating that the image quality of the target object sample image is unreasonable.

[0104] In this embodiment, if the candidate object sample images obtained through multiple iterations are all below a preset quality score threshold, it indicates that the information used to generate the candidate object sample images, i.e., the information used to generate the sample images, needs to be adjusted. In this case, a prompt message can be sent to the user. Upon receiving the prompt message, the user can adjust at least one sample image generation information based on their experience. After completing the adjustment of the sample image generation information, steps S310-S340 are repeated.

[0105] In this embodiment, when the cumulative number of target object sample images exceeds a threshold for the number of sample images, an object image sample dataset is obtained. Then, the object image processing model is trained based on the object image sample dataset. By improving the image quality in the object image sample dataset, the performance of the object image processing model is improved.

[0106] Example 4

[0107] Figure 4 This is a schematic diagram of the structure of an object sample image generation device provided in an embodiment of the present invention, as shown below. Figure 4 As shown, the device includes: a prompt statement determination module 410, a sample image generation module 420, and a sample image filtering module 430.

[0108] The prompt statement determination module 410 is used to determine the prompt statement to be applied based on at least one first candidate word corresponding to at least one first attribute dimension, at least one second candidate word corresponding to at least one second attribute dimension, and statement logic verification conditions; wherein, the first attribute dimension is a mandatory attribute dimension when generating the prompt statement to be applied, and the second attribute dimension is an optional attribute dimension when generating the prompt statement to be applied.

[0109] The sample image generation module 420 is used to generate at least one candidate object sample image based on the prompt statement to be applied and the pre-trained object sample image generation model.

[0110] The sample image screening module 430 is used to perform image quality evaluation on the at least one candidate object sample image, obtain an image quality score corresponding to the at least one candidate object sample image, and determine the target object sample image based on the image quality score.

[0111] Based on the above embodiments, optionally, the prompt statement determination module 410 includes:

[0112] The mandatory attribute word determination unit is used to randomly select a first target word from all the first candidate words in each first attribute dimension.

[0113] The random attribute word determination unit is used to determine at least one target second attribute dimension from the at least one second attribute dimension based on the probability value corresponding to each second attribute dimension, so as to randomly select a second target word from each target second attribute dimension;

[0114] The prompt statement determination unit is used to determine the prompt statement to be applied based on the first target vocabulary, the second target vocabulary, and the statement logic verification conditions.

[0115] Based on the above embodiments, optionally, the prompt statement determining unit includes:

[0116] The sub-unit for determining the statement to be filtered is used to combine and assemble each of the first target words and each of the second target words based on the statement generation model to construct at least one prompt statement to be filtered.

[0117] The logical result determination subunit is used to perform logical checks on each of the proposed prompt statements to be filtered based on the logical check conditions of the statements, and determine the logical consistency result.

[0118] The compliance result determination subunit is used to perform grammatical compliance checks on the prompt statements to be screened based on the grammatical verification model, and determine the grammatical compliance result;

[0119] The prompt statement determination subunit is used to determine the prompt statement to be applied from the prompt statements to be filtered based on the logical consistency result and the syntax compliance result corresponding to each of the prompt statements to be filtered.

[0120] Based on the above embodiments, optionally, the sample image screening module 430 includes:

[0121] The aesthetic quality score determination unit is used to perform aesthetic quality assessment processing on each of the candidate object sample images based on the aesthetic quality assessment model to obtain the image aesthetic quality score corresponding to the candidate object sample image.

[0122] The face detection unit is used to perform object detection processing on the candidate object sample image based on the face detection model to obtain the face detection result corresponding to the candidate object sample image.

[0123] A correlation score determination unit is used to determine the text-image correlation score between the candidate object sample image and the prompt statement to be applied;

[0124] The quality score determination unit is used to determine the image quality score corresponding to each of the candidate object sample images based on the image aesthetic quality score, the face detection result, and the text-image correlation score.

[0125] Based on the above embodiments, optionally, the quality score determination unit is specifically used for each of the candidate object sample images. If the face detection result is that no face result is detected, then the image quality score corresponding to the candidate object sample image is the lowest quality score; if the face detection result is that a face result is detected, then the image quality score corresponding to the candidate object sample image is determined based on the image aesthetic quality score and the text-image correlation score.

[0126] Based on the above embodiments, optionally, the sample image screening module 430 further includes: a target image determination unit;

[0127] The target image determination unit is used to determine the candidate object sample image whose image quality score is greater than or equal to a preset quality score threshold as the target object sample image.

[0128] Based on the above embodiments, optionally, the object sample image generation device further includes: a sample dataset application module;

[0129] The sample dataset application module is used to repeatedly execute the steps of determining the prompt statement to be applied based on the first candidate words corresponding to at least one first attribute dimension, the second candidate words corresponding to at least one second attribute dimension, and the statement logic verification conditions; generating at least one candidate object sample image; and determining the target object sample image based on the image quality score, until the cumulative number of target object sample images exceeds the sample image number threshold; constructing an object image sample dataset based on each target object sample image; and training the object image processing model based on the object image sample dataset.

[0130] The sample dataset application module is further configured to provide feedback prompts if the image quality scores of the target object sample images obtained through multiple iterations are all less than a preset quality score threshold, so that the user can adjust the sample image generation criteria based on the prompts. The sample image generation criteria include at least one of the following: a first attribute dimension, a second attribute dimension, a first candidate word corresponding to the first attribute dimension, a second candidate word corresponding to the at least one second attribute dimension, and a preset logical verification condition. After the sample image generation criteria are adjusted, the steps of determining the prompt statement to be applied, generating at least one candidate object sample image, and determining the target object sample image based on the image quality score are repeated.

[0131] The technical solution of this invention determines the prompt statement to be applied based on at least one first candidate word corresponding to at least one first attribute dimension, at least one second candidate word corresponding to at least one second attribute dimension, and statement logic verification conditions. The first attribute dimension is a mandatory attribute dimension when generating the prompt statement, and the second attribute dimension is an optional attribute dimension. Then, based on the prompt statement and a pre-trained object sample image generation model, at least one candidate object sample image is generated. The image quality of the at least one candidate object sample image is then evaluated to obtain an image quality score corresponding to the at least one candidate object sample image, and the target object sample image is determined based on the image quality score. The technical solution provided in this embodiment, under the constraint of statement logic verification conditions, randomly combines words in the mandatory and optional attribute dimensions to automatically generate prompt statements, thereby improving the generation efficiency of prompt statements and enhancing their richness, complexity, and diversity. This, in turn, improves the generation efficiency and image quality of object sample images. Furthermore, the generated object sample images are evaluated using an image quality scoring mechanism to obtain object sample images that meet the image quality standards, further improving the image quality of the object sample images.

[0132] The object sample image generation apparatus provided in this embodiment of the invention can execute the object sample image generation method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the method.

[0133] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the protection scope of the embodiments of the present invention.

[0134] Example 5

[0135] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Figure 5 A block diagram is shown of an exemplary electronic device 50 suitable for implementing embodiments of the present invention. Figure 5 The electronic device 50 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.

[0136] like Figure 5As shown, the electronic device 50 is represented in the form of a general-purpose computing device. The components of the electronic device 50 may include, but are not limited to: one or more processors or processing units 501, system memory 502, and bus 503 connecting different system components (including system memory 502 and processing unit 501).

[0137] Bus 503 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. Examples of these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.

[0138] Electronic device 50 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by electronic device 50, including volatile and non-volatile media, removable and non-removable media.

[0139] System memory 502 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 504 and / or cache memory 505. Electronic device 50 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 506 may be used to read and write non-removable, non-volatile magnetic media (… Figure 5 Not shown; usually referred to as a "hard drive"). Although Figure 5 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 503 via one or more data media interfaces. Memory 502 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.

[0140] A program / utility 508 having a set (at least one) of program modules 507 may be stored, for example, in memory 502. Such program modules 507 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 507 typically perform the functions and / or methods described in the embodiments of the present invention.

[0141] Electronic device 50 can also communicate with one or more external devices 509 (e.g., keyboard, pointing device, display 510, etc.), and with one or more devices that enable a user to interact with the electronic device 50, and / or with any device that enables the electronic device 50 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 511. Furthermore, electronic device 50 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 512. As shown, network adapter 512 communicates with other modules of electronic device 50 via bus 503. It should be understood that, although... Figure 5 As not shown, other hardware and / or software modules may be used in conjunction with electronic device 50, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0142] The processing unit 501 executes various functional applications and page processing by running programs stored in the system memory 502, such as implementing the object sample image generation method provided in the embodiments of the present invention.

[0143] Example 6

[0144] This invention also provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform a method for generating an object sample image, the method comprising:

[0145] Based on at least one first candidate word corresponding to a first attribute dimension, at least one second candidate word corresponding to a second attribute dimension, and statement logic verification conditions, a prompt statement to be applied is determined; wherein, the first attribute dimension is a mandatory attribute dimension when generating the prompt statement to be applied, and the second attribute dimension is an optional attribute dimension when generating the prompt statement to be applied.

[0146] Based on the prompt statement to be applied and the pre-trained object sample image generation model, at least one candidate object sample image is generated.

[0147] Image quality is evaluated on the at least one candidate object sample image to obtain an image quality score corresponding to the at least one candidate object sample image, and the target object sample image is determined based on the image quality score.

[0148] The computer storage medium of this invention can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0149] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.

[0150] The program code contained on a computer-readable medium may be transmitted using any suitable medium, including—but not limited to—wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0151] Computer program code for performing the operations of embodiments of the present invention can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0152] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.

Claims

1. A method for generating object sample images, characterized in that, include: Based on at least one first candidate word corresponding to a first attribute dimension, at least one second candidate word corresponding to a second attribute dimension, and statement logic verification conditions, a prompt statement to be applied is determined; wherein, the first attribute dimension is a mandatory attribute dimension when generating the prompt statement to be applied, and the second attribute dimension is an optional attribute dimension when generating the prompt statement to be applied. Based on the prompt statement to be applied and the pre-trained object sample image generation model, at least one candidate object sample image is generated. Image quality assessment is performed on the at least one candidate object sample image to obtain an image quality score corresponding to the at least one candidate object sample image, and the target object sample image is determined based on the image quality score; The step of determining the prompt statement to be applied based on at least one first candidate word corresponding to at least one first attribute dimension, at least one second candidate word corresponding to at least one second attribute dimension, and statement logic verification conditions includes: For each of the first attribute dimensions, a first target word is randomly selected from all the first candidate words of the first attribute dimension; wherein, the first attribute dimension includes at least one of the following: age dimension, gender dimension and occupation dimension, and the multiple first candidate words corresponding to each first attribute dimension constitute a mandatory attribute pool; Based on the probability value corresponding to each second attribute dimension, at least one target second attribute dimension is determined from the at least one second attribute dimension, so as to randomly select a second target word from each target second attribute dimension; wherein, the second attribute dimension includes at least one of: image background dimension, object emotion dimension and object special mark dimension, and the multiple second candidate words corresponding to each second attribute dimension constitute a random attribute pool; Based on the first target vocabulary, the second target vocabulary, and the statement logic verification conditions, the prompt statement to be applied is determined.

2. The method according to claim 1, characterized in that, The step of determining the prompt statement to be applied based on the first target vocabulary, the second target vocabulary, and the statement logic verification conditions includes: Based on the sentence generation model, each of the first target words and each of the second target words are combined and assembled to construct at least one prompt sentence to be filtered; For each of the proposed prompt statements to be filtered, a logical consistency test is performed on the proposed prompt statements based on the logical test conditions to determine the logical consistency result; The syntax compliance of the prompt statements to be screened is checked based on the syntax check model to determine the syntax compliance result; Based on the logical consistency result and the syntax compliance result corresponding to each of the proposed prompt statements, the prompt statement to be applied is determined from each of the proposed prompt statements.

3. The method according to claim 1, characterized in that, The step of evaluating the image quality of the at least one candidate object sample image to obtain an image quality score corresponding to the at least one candidate object sample image includes: For each of the candidate object sample images, an aesthetic quality assessment process is performed on the candidate object sample images based on the aesthetic quality assessment model to obtain the image aesthetic quality score corresponding to the candidate object sample images. Based on the face detection model, the candidate object sample image is processed for object detection to obtain the face detection result corresponding to the candidate object sample image; Determine the text-image relevance score between the candidate object sample image and the prompt statement to be applied; Based on the image aesthetic quality score, the face detection result, and the text-image correlation score, an image quality score corresponding to each of the candidate object sample images is determined.

4. The method according to claim 3, characterized in that, The step of determining the image quality score corresponding to each of the candidate object sample images based on the image aesthetic quality score, the face detection result, and the text-image correlation score includes: For each of the candidate object sample images, if the face detection result is no face detected, then the image quality score corresponding to the candidate object sample image is the lowest quality score. If the face detection result indicates that a face has been detected, then based on the image aesthetic quality score and the text-image correlation score, the image quality score corresponding to the candidate object sample image is determined.

5. The method according to claim 1, characterized in that, The step of determining the target object sample image based on the image quality score includes: The candidate object sample images whose image quality scores are greater than or equal to a preset quality score threshold are determined as target object sample images.

6. The method according to claim 1, characterized in that, The method further includes: Repeat the steps of determining the prompt statement to be applied, generating at least one candidate object sample image, and determining the target object sample image based on the image quality score, based on the first candidate word corresponding to at least one first attribute dimension, the second candidate word corresponding to at least one second attribute dimension, and the statement logic check condition, until the cumulative number of the target object sample images exceeds the sample image number threshold, and obtain the object image sample dataset based on each of the target object sample images. The object image processing model is trained based on the object image sample dataset.

7. The method according to claim 6, characterized in that, The method further includes: If the image quality score of the target object sample image obtained through multiple iterations is less than the preset quality score threshold, a prompt message is provided so that the user can adjust the sample image generation basis information based on the prompt message; wherein, the sample image generation basis information includes at least one of the following: the first attribute dimension, the second attribute dimension, the first candidate word corresponding to the first attribute dimension, the second candidate word corresponding to the at least one second attribute dimension, and the statement logic verification condition. After the information based on the sample image generation is adjusted, the steps of determining the prompt statement to be applied, generating at least one candidate object sample image, and determining the target object sample image based on the image quality score are repeated.

8. An apparatus for generating object sample images, characterized in that, include: The prompt statement determination module is used to determine the prompt statement to be applied based on at least one first candidate word corresponding to at least one first attribute dimension, at least one second candidate word corresponding to at least one second attribute dimension, and statement logic verification conditions; wherein, the first attribute dimension is a mandatory attribute dimension when generating the prompt statement to be applied, and the second attribute dimension is an optional attribute dimension when generating the prompt statement to be applied. The sample image generation module is used to generate at least one candidate object sample image based on the prompt statement to be applied and the pre-trained object sample image generation model. The sample image screening module is used to perform image quality evaluation on the at least one candidate object sample image to obtain an image quality score corresponding to the at least one candidate object sample image, so as to determine the target object sample image based on the image quality score; The prompt statement determination module includes: The mandatory attribute word determination unit is used to randomly select a first target word from all the first candidate words of the first attribute dimension for each first attribute dimension; wherein, the first attribute dimension includes at least one of the following: age dimension, gender dimension and occupation dimension, and the multiple first candidate words corresponding to each first attribute dimension constitute a mandatory attribute pool. The random attribute word determination unit is used to determine at least one target second attribute dimension from the at least one second attribute dimension according to the probability value corresponding to each second attribute dimension, so as to randomly select a second target word from each target second attribute dimension; wherein, the second attribute dimension includes at least one of: image background dimension, object emotion dimension and object special mark dimension, and the multiple second candidate words corresponding to each second attribute dimension constitute a random attribute pool; The prompt statement determination unit is used to determine the prompt statement to be applied based on the first target vocabulary, the second target vocabulary, and the statement logic verification conditions.

9. An electronic device, characterized in that, The electronic device includes: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the object sample image generation method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Image generation method and device, electronic equipment and storage medium

    CN116797684A

  • Model fine tuning method, model fine tuning device and electronic equipment

    CN118153638A