An evolution algorithm-based text-to-image large model prompt optimization method and system
Through the evolutionary algorithm-based prompt word optimization method for large-scale cultural image models, diverse and expected prompt words are automatically generated, which solves the problems of existing methods such as long time consumption, high adjustment difficulty and lack of image diversity, and improves the dataset expansion effect.
Patent Information
- Application Number
- CN202510073559.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-17
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2045-01-17
AI Technical Summary
The existing methods for generating prompt words for large text-image models are time-consuming, difficult to adjust, lack diversity in generated images, have limited coverage, and are less effective in expanding dataset tasks.
An evolutionary algorithm-based large-scale prompt word optimization method for the text-based image model is adopted. Initial prompt words are generated through ChatGPT-4. The evolutionary algorithm is used to process the extended image collection, calculate the prompt word score, and iterative optimization is used to generate prompt words that meet expectations and diversity.
Automatically generate prompt words that enrich scene information, reduce unexpected image generation, increase image diversity, and improve dataset expansion effects. It is suitable for different large language models and large text-image models.
Smart Images

Figure CN119919756B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of machine learning technology, and more specifically, relates to a method and system for optimizing prompt words in a large model of a text graph based on an evolutionary algorithm. Background Art
[0002] The large-scale text-based image model generates images that match user-provided text prompts. It has been widely used in fields such as art creation, advertising design, and game development, and has also demonstrated great potential for expanding small sample size datasets. The pre-trained large-scale text-based image model can generate a large number of images using prompts to expand small sample size datasets, effectively alleviating the data shortage problem in machine learning.
[0003] Existing methods for generating prompt words for large-scale cultural image models can be mainly divided into three categories: the first method involves manually adjusting prompt words based on human experience. This method relies entirely on the user's subjective judgment and accumulated experience. The user gradually adjusts the prompt word content by observing the image effects generated by the large-scale cultural image model. The second method is a prompt word generation method based on fixed templates. Using predefined structured templates (such as "[subject] + [style] + [environment] + [detail modification]"), the user only needs to fill in the specific content to generate prompt words. The third method is a prompt word generation method based on a knowledge base (such as DiffusionDB). By querying the knowledge base for high-quality prompt words and their corresponding generation effects, these prompt words can be directly reused or adjusted to meet the needs.
[0004] However, the above methods all have some drawbacks that cannot be ignored:
[0005] First, manual adjustment of prompt words based on human experience lacks systematic guidance, requiring users to make multiple attempts and repeated adjustments before generating an image that meets their expectations. This results in manual adjustment of prompt words being time-consuming and difficult.
[0006] Second, the prompt word generation method based on fixed templates may lack diversity in the images generated by prompt words due to the fixed nature of the templates.
[0007] Third, the prompt word generation method based on the knowledge base cannot generate the expected images due to the limited coverage of the knowledge base and insufficient update frequency.
[0008] Fourth, the prompt words generated by the above three existing methods mainly focus on optimizing single-time generation results and lack targeted design for data diversity, distribution balance, and task generalization capabilities. As a result, the prompt words are less effective in expanding dataset tasks. Summary of the Invention
[0009] In response to the above-mentioned defects or improvement needs of the prior art, the present invention provides a method and system for optimizing prompt words for a large model of a cultural graph based on an evolutionary algorithm, which aims to solve the technical problems of the existing method of manually adjusting prompt words based on human experience, which is time-consuming and difficult to adjust; and the technical problem that the existing prompt word generation method based on a fixed template lacks diversity in the pictures generated by the prompt words due to the fixed nature of the template; and the technical problem that the existing prompt word generation method based on a knowledge base cannot generate the expected pictures due to the limited coverage of the knowledge base and insufficient update frequency; and the technical problem that the prompt words generated by the three existing methods are poor in the effect of generating prompt words on the extended dataset task because they mainly focus on optimizing the single generation results and ignore the performance on the extended dataset task.
[0010] To achieve the above objectives, according to one aspect of the present invention, a method and system for optimizing prompt words in a large model of a cultural graph based on an evolutionary algorithm is provided, comprising the following steps:
[0011] (1) Obtain a dataset, which includes a training set and a test set.
[0012] (2) For each category in the training set obtained in step (1), use the ChatGPT-4 model to generate the corresponding prompt word for the category.
[0013] (3) For each prompt word corresponding to the category obtained in step (2), sampled prompt words are randomly sampled multiple times from the prompt word, and the obtained multiple sampled prompt words are input into the Wenshengtu large model to obtain extended pictures of the categories corresponding to all sampled prompt words. All the obtained extended pictures constitute the extended picture set corresponding to the category.
[0014] (4) Using an evolutionary algorithm to process the extended picture set corresponding to each category obtained in step (3) to obtain an optimized prompt word for the category corresponding to the extended picture set corresponding to the category.
[0015] (5) For the optimized prompt words corresponding to the category of the extended picture set corresponding to each category in the training set obtained in step (4), sampled prompt words are randomly sampled from the prompt words multiple times, and the obtained multiple sampled prompt words are input into the Wenshengtu large model to obtain extended pictures of the categories corresponding to all sampled prompt words. All the obtained extended pictures constitute the extended picture set corresponding to the category.
[0016] (6) Using an evolutionary algorithm to process the extended picture set corresponding to each category in the training set obtained in step (5) to obtain an optimized prompt word corresponding to the category of the extended picture set corresponding to the category.
[0017] (7) For each category in the training set, the optimized prompt word corresponding to the category of the extended picture set corresponding to the category obtained in step (6) is used as the final prompt word corresponding to the category.
[0018] Preferably, step (4) specifically includes the following steps:
[0019] (4-1) Set counter i=1;
[0020] (4-2) Determine whether i is greater than the number of categories in the data set obtained in step (1) (10 in this example). If so, the process ends; otherwise, proceed to step (4-3);
[0021] (4-3) Set counter j = 1;
[0022] (4-4) Determine whether j is greater than a preset number of iterations (the value range is 8 to 10, preferably 10). If so, proceed to step (4-12); otherwise, proceed to step (4-5);
[0023] (4-5) Obtain the prompt word corresponding to the i-th category in the training set obtained in step (2) as the current prompt word;
[0024] (4-6) Obtaining the unexpected picture set and the expected picture set corresponding to the i-th category in the training set from the extended picture set corresponding to the i-th category in the training set obtained in step (3);
[0025] (4-7) Using an evolutionary algorithm to process the current prompt word obtained in step (4-5) to obtain a new prompt word;
[0026] (4-8) using the unexpected image set corresponding to the i-th category in the training set obtained in step (4-6) to process the new prompt word obtained in step (4-7) to obtain a score for the new prompt word;
[0027] (4-9) using the unexpected image set obtained in step (4-6) to process the current prompt word obtained in step (4-5) to obtain a score for the current prompt word;
[0028] (4-10) The score of the current prompt word obtained in step (4-9) and the score of the new prompt word obtained in step (4-8) are used as the prompt word with the higher score as the current prompt word in step (4-5), and the current prompt word is used as the optimized prompt word for the i-th category in the training set;
[0029] (4-11) Set j = j + 1 and return to step (4-4);
[0030] (4-12) Set i=i+1 and return to step (4-2).
[0031] Preferably, steps (4-6) are performed by checking each picture in the extended picture set corresponding to the i-th category in the training set, and if there is a subject other than the cat or dog category in the picture, then the picture is an unexpected picture, otherwise the picture is an expected picture;
[0032] Steps (4-7) are specifically as follows: first, use the large language model ChatGPT-4 to perform a self-crossover operation on the current prompt word obtained in step (4-5) to obtain the cross-processed prompt word; then, use the large language model ChatGPT-4 to perform a mutation operation on the cross-processed prompt word to obtain a new prompt word.
[0033] Preferably, steps (4-8) are specifically:
[0034] The new prompt word obtained in steps (4-7) is input into the Wenshengtu model to generate an extended picture of the category corresponding to the prompt word, and the process is repeated multiple times. The multiple extended pictures obtained constitute the extended picture set corresponding to the i-th category in the training set.
[0035] Then, calculate the similarity between the unexpected image set obtained in steps (4-6) and the expanded image set corresponding to the i-th category in the training set:
[0036]
[0037] Where m∈[1, the total number of extended pictures N in the extended picture set corresponding to the i-th category in the training set g ], n∈[1, the total number of pictures in the unexpected picture set N d ], Represents the extended image set I corresponding to the i-th category in the training set g The mth picture in Represents the unexpected picture set I obtained in steps (4-6) c The nth picture in N g Indicates the number of extended images in the extended image set corresponding to the i-th category in the training set, N d Indicates the number of unexpected images in the unexpected image set. Represents the extended image set I corresponding to the i-th category in the training set g The mth picture in and unexpected picture collection I c The nth picture , and there are:
[0038]
[0039] in and They represent the feature vector of the mth picture in the extended picture set corresponding to the i-th category in the training set and the feature vector of the nth picture in the unexpected picture set, respectively. and Respectively represent the feature vector of the mth picture in the extended picture set corresponding to the i-th category in the training set The Euclidean norm of and the feature vector of the nth picture in the unexpected picture set The Euclidean norm of the training set is the feature vector of the mth picture in the extended picture set corresponding to the i-th category is extracted by contrastive language-image pre-training CLIP and is equal to:
[0040]
[0041] Where Embedding represents the visual encoder of CLIP.
[0042] Then, the similarity between the expected image set obtained in steps (4-6) and the extended image set corresponding to the i-th category in the training set is calculated:
[0043]
[0044] Where: N c Represents the total number of images of the i-th category in the training set.
[0045] Then, the confidence of the expanded image set corresponding to the i-th category in the training set is calculated:
[0046]
[0047] in Represents the extended image set I corresponding to the i-th category in the training set g The confidence of the mth image in is equal to:
[0048]
[0049] Where p represents the extended image set I corresponding to the i-th category in the training set by the CLIP model. g The mth picture The predicted probability distribution of is equal to:
[0050] p=[p1,p2,...,p T ]
[0051] Where T is the number of categories of images in the dataset (10 in this example), p k is the extended image set I corresponding to the i-th category in the ResNet50 model prediction training set gThe mth picture The probability of belonging to the kth class, where k∈[1,T].
[0052] Finally, the similarity between the unexpected image set and the extended image set corresponding to the i-th category in the training set, the similarity between the expected image set and the extended image set corresponding to the i-th category in the training set, and the confidence of the extended image set corresponding to the i-th category in the training set are added together to obtain the score of the new prompt word, that is:
[0053]
[0054] Preferably, step (6) specifically includes the following sub-steps:
[0055] (6-1) Set counter f = 1;
[0056] (6-2) Determine whether f is greater than the number of categories in the data set obtained in step (1). If so, the process ends; otherwise, proceed to step (6-3).
[0057] (6-3) Set counter h = 1;
[0058] (6-4) Determine whether h is greater than the preset number of iterations. If so, proceed to step (6-12); otherwise, proceed to step (6-5);
[0059] (6-5) Obtain the optimized prompt word of the category corresponding to the extended picture set corresponding to the f-th category in the training set obtained in step (4) as the current prompt word;
[0060] (6-6) Obtain a set of images lacking diversity from the expanded set of images corresponding to the f-th category in the training set obtained in step (5);
[0061] (6-7) Using an evolutionary algorithm to process the current prompt word obtained in step (6-5) to obtain a new prompt word;
[0062] (6-8) using the image set lacking diversity obtained in step (6-6) to process the new prompt word obtained in step (6-7) to obtain a score for the new prompt word;
[0063] (6-9) using the image set lacking diversity obtained in step (6-6) to process the current prompt word obtained in step (6-5) to obtain a score for the current prompt word;
[0064] (6-10) The score of the current prompt word obtained in step (6-9) and the score of the new prompt word obtained in step (6-8) are used as the prompt word with the higher score as the current prompt word obtained in step (6-5), and the current prompt word is used as the optimized prompt word for the f-th category in the training set;
[0065] (6-11) Set h = h + 1 and return to step (6-4);
[0066] (6-11) Set f=f+1 and return to step (6-2).
[0067] Preferably, step (6-6) is performed by checking each picture in the extended picture set corresponding to the f-th category in the training set. If the similarity between the picture and the picture corresponding to the f-th category in the training set obtained in step (1) is high, that is, the similarity between the picture and the picture corresponding to the f-th category in the training set reaches a preset threshold, it means that the picture does not expand new information and the picture is a picture lacking diversity.
[0068] Preferably, steps (6-8) are specifically:
[0069] First, the new prompt word obtained in steps (6-7) is input into the Wenshengtu model to generate an extended picture of the category corresponding to the prompt word, and the process is repeated multiple times. The multiple extended pictures obtained constitute the extended picture set corresponding to the f-th category in the training set.
[0070] Then, calculate the diversity index S of the extended image set corresponding to the fth category in the training set div (I l ):
[0071]
[0072] Among them I l represents the extended image set corresponding to the f-th category in the training set, M is the total number of images in the extended image set corresponding to the f-th category in the training set, v′ q is the feature vector of the qth picture in the extended picture set corresponding to the fth category in the training set (where q∈[1,M]), is the average feature vector of all images in the extended image set corresponding to the f-th category in the training set, and has:
[0073]
[0074] in Represents the distance between the feature vector of the qth picture in the extended picture set corresponding to the fth category in the training set and the average feature vector of all pictures in the extended picture set corresponding to the fth category in the training set:
[0075]
[0076] Then, calculate the similarity between the image set lacking diversity and the expanded image set corresponding to the f-th category in the training set:
[0077]
[0078] Where: N a Represents the total number of images in the image set that lacks diversity, r∈[1, the total number of extended images in the extended image set corresponding to the f-th category in the training set N l ], e∈[1, the total number of pictures in the lack of diversity picture set N a ], Represents the extended image set I corresponding to the fth category in the training set l The rth picture in Represents the lack of diversity image set I obtained in step (6-6) s The e-th picture in .
[0079] Then, the confidence of the expanded image set corresponding to the f-th category in the training set is calculated:
[0080]
[0081] Finally, the diversity index of the extended image set corresponding to the f-th category in the training set, the similarity between the image set lacking diversity and the extended image set corresponding to the f-th category in the training set, and the confidence of the extended image set corresponding to the f-th category in the training set are added together to obtain the score of the new prompt word, that is:
[0082]
[0083] According to another aspect of the present invention, a system for optimizing prompt words for a large model of a cultural graph based on an evolutionary algorithm is provided, comprising:
[0084] The first module is used to obtain a data set, which includes a training set and a test set.
[0085] The second module is used to use the ChatGPT-4 model to generate the corresponding prompt word for each category in the training set obtained in the first module.
[0086] The third module is used to randomly sample the prompt words corresponding to each category obtained in the second module multiple times to obtain sampled prompt words, and input the multiple sampled prompt words obtained into the Wenshengtu large model to obtain extended pictures of the categories corresponding to all sampled prompt words. All the obtained extended pictures constitute the extended picture set corresponding to the category.
[0087] The fourth module is used to process the extended picture set corresponding to each category obtained by the third module using an evolutionary algorithm to obtain optimized prompt words for the category corresponding to the extended picture set corresponding to the category.
[0088] The fifth module is used to randomly sample the optimized prompt words for the category corresponding to the extended picture set corresponding to each category in the training set obtained in the fourth module multiple times to obtain sampled prompt words, and input the obtained multiple sampled prompt words into the Wenshengtu large model to obtain extended pictures of the categories corresponding to all sampled prompt words. All the obtained extended pictures constitute the extended picture set corresponding to the category.
[0089] The sixth module is used to process the extended picture set corresponding to each category in the training set obtained in the fifth module using an evolutionary algorithm to obtain optimized prompt words corresponding to the category of the extended picture set corresponding to the category.
[0090] The seventh module is used to use, for each category in the training set, the optimized prompt words corresponding to the category of the extended picture set corresponding to the category obtained in the sixth module as the final prompt words corresponding to the category.
[0091] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects compared with the prior art:
[0092] (1) Due to the adoption of step (2), the present invention uses the ChatGPT-4 model to generate prompt words corresponding to each category, thereby automatically obtaining prompt words containing rich scene information and diversity, thereby solving the technical problems of the existing method of manually adjusting prompt words based on human experience, which is time-consuming and difficult to adjust;
[0093] (2) The present invention adopts steps (6-5) to (6-10), which updates the prompt word by using an evolutionary algorithm, calculates the scores of the prompt word before and after the update, and measures the diversity of the picture set generated by the prompt word by the score, thereby obtaining prompt words that can generate more diverse pictures. Therefore, it can solve the technical problem that the existing prompt word generation method based on a fixed template lacks diversity in the pictures generated by the prompt word due to the fixed nature of the template;
[0094] (3) The present invention adopts steps (4-5) to (4-10), which updates the prompt words by using an evolutionary algorithm, and calculates the scores of the prompt words before and after the update. The scores are used to measure whether the picture set generated by the prompt words meets the expectations, thereby obtaining prompt words that can generate pictures that meet the user's expectations. Therefore, it can solve the technical problem that the existing knowledge base-based prompt word generation method cannot generate the expected pictures due to the limited coverage of the knowledge base and insufficient update frequency;
[0095] (4) The present invention adopts steps (4-8) and (6-8), and its prompt word scores respectively measure whether the prompt word generated picture set meets expectations and its diversity. Therefore, the prompt words are optimized at the picture set level, rather than focusing only on the generation quality of a single picture. Therefore, it can solve the technical problem that the prompt words generated by the three existing prompt word generation methods have poor effects on the extended dataset task;
[0096] (5) The method proposed in this paper is compatible with any large language model and large text-graph model. It can seamlessly integrate large language models of different architectures (such as the ChatGPT series, LLaMA, etc.) and large text-graph models (such as StableDiffusion, DALL·E, etc.), giving full play to the advantages of each model and having high versatility and flexibility. BRIEF DESCRIPTION OF THE DRAWINGS
[0097] Figure 1 Schematic diagram of the method for optimizing prompt words of the large-scale model of cultural graph based on evolutionary algorithm of the present invention;
[0098] Figure 2 Schematic diagram of prompt word template and sampling method of the prompt word optimization method and system of the cultural graph large model based on evolutionary algorithm of the present invention;
[0099] Figure 3 Schematic diagram of a prompt word updating and selection method of a prompt word optimization method for a large-scale cultural graph model based on an evolutionary algorithm according to the present invention;
[0100] Figure 4 The present invention is a flow chart of a method for optimizing prompt words in a large-scale cultural graph model based on an evolutionary algorithm. DETAILED DESCRIPTION
[0101] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely for the purpose of explaining the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.
[0102] The basic idea of this invention is to use an evolutionary algorithm to cross and mutate the prompt words of the large-scale cultural graph model to generate new prompt words. Subsequently, the optimization direction of the prompt words is jointly constrained by the labeling feedback of the pictures and the quality of the pictures generated by the new prompt words, so as to iteratively obtain the optimized prompt words. In addition, the large-scale cultural graph model is controlled to generate as diverse pictures as possible that meet user expectations, thereby expanding small-scale datasets and improving model performance on downstream tasks such as image classification and object detection.
[0103] The overall idea of the present invention is:
[0104] First, for a small-scale dataset, we used the large language model ChatGPT-4 to generate prompt words, and used these prompt words to control the large text-based graph model to generate images, thus obtaining an extended image collection.
[0105] Second, for each category in the generated extended image set, select the unexpected image set. Use an evolutionary algorithm to optimize the prompt words for the category of the unexpected image set. Iteratively obtain the optimized new prompt words for the category. The newly obtained prompt words can reduce the generation of unexpected images.
[0106] Third, for each category in the generated extended image set, select the image sets that lack diversity. Use an evolutionary algorithm to optimize the prompt words for the corresponding categories of the image sets that lack diversity. Iteratively obtain new optimized prompt words for the categories. The newly obtained prompt words can increase the diversity of the generated images.
[0107] Fourth, you can use the optimized prompt words to generate images to expand small-scale datasets and improve model performance on downstream tasks such as image classification and object detection.
[0108] like Figure 1 and Figure 4 As shown, the present invention provides a method and system for optimizing prompt words of a large model of a cultural graph based on an evolutionary algorithm, comprising the following steps:
[0109] (1) Obtain a dataset, which includes a training set and a test set.
[0110] Specifically, the dataset in this step is the Stanford University 37-category cat and dog dataset, from which 10 categories are selected, including five categories of cats and five categories of dogs, 200 pictures per category, and 1000 pictures each for the training set and the test set.
[0111] (2) For each category in the training set obtained in step (1), use the ChatGPT-4 model to generate the corresponding prompt word for that category (i.e., 10 prompt words are generated for 10 categories).
[0112] For example, for the Bengal cat category in the training set obtained in step (1), the prompt words generated by the ChatGPT-4 model are:
[0113] [a whimsical digital painting of,a playful cartoon image of][vivid,serene,high-contrast,colorful]Bengal cat[playing in a vibrant flower bed,lounging on a fluffy rug by a fireplace,climbing a tree in a sunny park,exploring a colorful backyard,chasing butterflies in a sunny meadow]
[0114] The advantage of this step is that the large language model ChatGPT-4 can generate diverse prompt words containing rich scene information, and then generate information-rich pictures.
[0115] (3) For each category corresponding to the prompt word obtained in step (2), a sampling prompt word is obtained by randomly sampling from the prompt word multiple times (100 times in this example) (the sampling process is as follows Figure 2 As shown, each sampling obtains a sampling prompt word), and the obtained multiple sampling prompt words are input into the Wenshengtu large model to obtain the extended pictures of the categories corresponding to all the sampling prompt words, and all the obtained extended pictures constitute the extended picture set corresponding to the category.
[0116] (4) Using an evolutionary algorithm, the extended picture set corresponding to each category obtained in step (3) is processed to obtain an optimized prompt word for the category corresponding to the extended picture set corresponding to the category.
[0117] This step specifically includes the following steps:
[0118] (4-1) Set counter i=1;
[0119] (4-2) Determine whether i is greater than the number of categories in the data set obtained in step (1) (10 in this example). If so, the process ends; otherwise, proceed to step (4-3);
[0120] (4-3) Set counter j = 1;
[0121] (4-4) Determine whether j is greater than a preset number of iterations (the value range is 8 to 10, preferably 10). If so, proceed to step (4-12); otherwise, proceed to step (4-5);
[0122] (4-5) Obtain the prompt word corresponding to the i-th category in the training set obtained in step (2) as the current prompt word;
[0123] (4-6) Obtaining the unexpected picture set and the expected picture set corresponding to the i-th category in the training set from the extended picture set corresponding to the i-th category in the training set obtained in step (3);
[0124] Specifically, this step is to check each picture in the extended picture set corresponding to the i-th category in the training set. If there are subjects other than cat and dog categories in the picture, such as tiger subjects or some building subjects, which are not the cat and dog subjects involved in the present invention, then the picture is an unexpected picture, otherwise the picture is an expected picture.
[0125] (4-7) Using an evolutionary algorithm to process the current prompt word obtained in step (4-5) to obtain a new prompt word;
[0126] Specifically, this step uses the large language model ChatGPT-4 and an evolutionary algorithm to process the current prompt word to generate a new prompt word.
[0127] This step (4-7) is specifically as follows: First, the large language model ChatGPT-4 is used to perform a self-crossover operation on the current prompt word obtained in step (4-5) to obtain a cross-processed prompt word (which includes at least 15 words and is used as a new prompt word).
[0128] Then, the large language model ChatGPT-4 is used to perform a mutation operation on the cross-processed prompt words, that is, by adding, deleting or modifying elements in the cross-processed prompt words (for example, the prompt word "a cat is playing" is mutated to "a cute cartoon kitten running in the garden") to obtain new prompt words.
[0129] For example, the results of crossover and mutation processing on the prompt words corresponding to the Bengal cat category are as follows:
[0130] [a whimsical digital painting of,a playful cartoon image of][vivid,bright,serene,high-contrast,colorful]Bengal cat[playing in a vibrant flowerbed with its tongue out,lounging on a fluffy rug by a fireplace with itstongue slightly visible,climbing a tree in a sunny park with its tongue flicking out,exploring a colorful backyard with its tongue tasting the air,chasing butterflies in a sunny meadow with its tongue extended]
[0131] The advantage of this step is that the large language model ChatGPT-4 uses an evolutionary algorithm to cross and mutate the prompt words, which can introduce more semantic details while retaining the original information, generating more informative and diverse prompt words.
[0132] (4-8) using the unexpected image set corresponding to the i-th category in the training set obtained in step (4-6) to process the new prompt word obtained in step (4-7) to obtain a score for the new prompt word;
[0133] This step specifically involves inputting the new prompt word obtained in steps (4-7) into the large model of the text image to generate an extended image of the category corresponding to the prompt word, and repeating this process multiple times (100 times in this example). The multiple extended images obtained constitute the extended image set corresponding to the i-th category in the training set.
[0134] Then, calculate the similarity between the unexpected image set obtained in steps (4-6) and the expanded image set corresponding to the i-th category in the training set:
[0135]
[0136] Where m∈[1, the total number of extended pictures N in the extended picture set corresponding to the i-th category in the training set g ], n∈[1, the total number of pictures in the unexpected picture set N d ], Represents the extended image set I corresponding to the i-th category in the training set g The mth picture in Represents the unexpected picture set I obtained in steps (4-6) c The nth picture in N g Indicates the number of extended images in the extended image set corresponding to the i-th category in the training set, N d Indicates the number of unexpected images in the unexpected image set. Represents the extended image set I corresponding to the i-th category in the training set g The mth picture in and unexpected picture collection I c The nth picture , and there are:
[0137]
[0138] in and They represent the feature vector of the mth picture in the extended picture set corresponding to the i-th category in the training set and the feature vector of the nth picture in the unexpected picture set, respectively. and Respectively represent the feature vector of the mth picture in the extended picture set corresponding to the i-th category in the training set The Euclidean norm of and the feature vector of the nth picture in the unexpected picture set The Euclidean norm of the training set is the feature vector of the mth picture in the extended picture set corresponding to the i-th category It is extracted through Contrastive Language-Image Pretraining (CLIP) and is equal to:
[0139]
[0140] Where Embedding represents the visual encoder of CLIP.
[0141] Then, the similarity between the expected image set obtained in steps (4-6) and the extended image set corresponding to the i-th category in the training set is calculated:
[0142]
[0143] Where: N c Represents the total number of images of the i-th category in the training set.
[0144] Then, the confidence of the expanded image set corresponding to the i-th category in the training set is calculated:
[0145]
[0146] in Represents the extended image set I corresponding to the i-th category in the training set g The confidence of the mth image in is equal to:
[0147]
[0148] Where p represents the extended image set I corresponding to the i-th category in the training set by the CLIP model. g The mth picture The predicted probability distribution of is equal to:
[0149] p=[p1,p2,...,p T ]
[0150] Where T is the number of categories of images in the dataset (10 in this example), p k is the extended image set I corresponding to the i-th category in the ResNet50 model prediction training set g The mth picture The probability of belonging to the kth class, where k∈[1,T].
[0151] Finally, the similarity between the unexpected image set and the extended image set corresponding to the i-th category in the training set, the similarity between the expected image set and the extended image set corresponding to the i-th category in the training set, and the confidence of the extended image set corresponding to the i-th category in the training set are added together to obtain the score of the new prompt word, that is:
[0152]
[0153] (4-9) using the unexpected image set obtained in step (4-6) to process the current prompt word obtained in step (4-5) to obtain a score for the current prompt word;
[0154] The processing process of this step is basically the same as the processing process of the above step (4-8), except that the new prompt word in step (4-8) is replaced by the current prompt word obtained in step (4-6), which will not be repeated here.
[0155] (4-10) The score of the current prompt word obtained in step (4-9) and the score of the new prompt word obtained in step (4-8) are used as the prompt word with the higher score as the current prompt word in step (4-5) (e.g. Figure 3 As shown), and the current prompt word is used as the optimized prompt word for the i-th category in the training set;
[0156] Specifically, by comparing the scores corresponding to the current prompt word and the newly generated prompt word, the one with the higher score is the better prompt word. If the newly generated prompt word is better, the new prompt word is used as the current prompt word and updated to the current prompt word in (4-5). Otherwise, it is not updated and recorded at the same time.
[0157] (4-11) Set j = j + 1 and return to step (4-4);
[0158] (4-12) Set i=i+1 and return to step (4-2).
[0159] The advantage of the above steps (4-5) to (4-10) is that the use of evolutionary algorithms for crossover and mutation can effectively increase the richness and diversity of prompt word information while retaining the original prompt word information. The use of the objective function to calculate the score of the prompt word can well measure whether the prompt word can reduce the generation of unexpected images, thereby iteratively selecting better prompt words, thereby obtaining prompt words that effectively reduce the generation of unexpected images.
[0160] (5) For the optimized prompt words corresponding to the extended picture set of each category in the training set obtained in step (4), the sampled prompt words are randomly sampled from the prompt words multiple times (100 times in this example) (the sampling process is as follows Figure 2 As shown), the obtained multiple sampling prompt words are input into the Wenshengtu large model to obtain the extended pictures of the categories corresponding to all the sampling prompt words, and all the obtained extended pictures constitute the extended picture set corresponding to the category.
[0161] (6) Using an evolutionary algorithm to process the extended picture set corresponding to each category in the training set obtained in step (5) to obtain an optimized prompt word corresponding to the category of the extended picture set corresponding to the category.
[0162] This step specifically includes the following steps:
[0163] (6-1) Set counter f = 1;
[0164] (6-2) Determine whether f is greater than the number of categories in the data set obtained in step (1) (10 in this example). If so, the process ends; otherwise, proceed to step (6-3);
[0165] (6-3) Set counter h = 1;
[0166] (6-4) Determine whether h is greater than a preset number of iterations (the value range is 8 to 10, preferably 10). If so, proceed to step (6-12); otherwise, proceed to step (6-5);
[0167] (6-5) Obtain the optimized prompt word of the category corresponding to the extended picture set corresponding to the f-th category in the training set obtained in step (4) as the current prompt word;
[0168] (6-6) Obtain a set of images lacking diversity from the expanded set of images corresponding to the f-th category in the training set obtained in step (5);
[0169] Specifically, this step is to check each picture in the extended picture set corresponding to the f-th category in the training set. If the similarity between the picture and the picture corresponding to the f-th category in the training set obtained in step (1) is high (that is, the similarity between the picture and the picture corresponding to the f-th category in the training set reaches a preset threshold, and the value range of the preset threshold is 0.90 to 0.99, preferably 0.95), it means that the picture has not expanded new information, and therefore the picture is a picture lacking diversity.
[0170] (6-7) Using an evolutionary algorithm to process the current prompt word obtained in step (6-5) to obtain a new prompt word;
[0171] It should be noted that the processing process of this step is basically the same as the processing process of the above steps (4-7), except that the current prompt word in step (4-7) is replaced by the current prompt word in step (6-6), which will not be repeated here.
[0172] (6-8) using the image set lacking diversity obtained in step (6-6) to process the new prompt word obtained in step (6-7) to obtain a score for the new prompt word;
[0173] Specifically, this step is as follows: first, the new prompt word obtained in steps (6-7) is input into the Wenshengtu model to generate an extended picture of the category corresponding to the prompt word, and this process is repeated multiple times (100 times in this example). The multiple extended pictures obtained constitute the extended picture set corresponding to the f-th category in the training set.
[0174] Then, calculate the diversity index S of the extended image set corresponding to the fth category in the training set div (I l ):
[0175]
[0176] Among them I l represents the extended image set corresponding to the f-th category in the training set, M is the total number of images in the extended image set corresponding to the f-th category in the training set, v′ q is the feature vector of the qth picture in the extended picture set corresponding to the fth category in the training set (where q∈[1,M]), is the average feature vector of all images in the extended image set corresponding to the f-th category in the training set, and has:
[0177]
[0178] in Represents the distance between the feature vector of the qth picture in the extended picture set corresponding to the fth category in the training set and the average feature vector of all pictures in the extended picture set corresponding to the fth category in the training set:
[0179]
[0180] Then, calculate the similarity between the image set lacking diversity and the expanded image set corresponding to the f-th category in the training set:
[0181]
[0182] Where: N a Represents the total number of images in the image set that lacks diversity, r∈[1, the total number of extended images in the extended image set corresponding to the f-th category in the training set N l ], e∈[1, the total number of pictures in the lack of diversity picture set N a ], Represents the extended image set I corresponding to the fth category in the training set l The rth picture in Represents the lack of diversity image set I obtained in step (6-6) s The e-th picture in .
[0183] Then, the confidence of the expanded image set corresponding to the f-th category in the training set is calculated:
[0184]
[0185] Finally, the diversity index of the extended image set corresponding to the f-th category in the training set, the similarity between the image set lacking diversity and the extended image set corresponding to the f-th category in the training set, and the confidence of the extended image set corresponding to the f-th category in the training set are added together to obtain the score of the new prompt word, that is:
[0186]
[0187] (6-9) using the image set lacking diversity obtained in step (6-6) to process the current prompt word obtained in step (6-5) to obtain a score for the current prompt word;
[0188] It should be noted that the processing process of this step is basically the same as the processing process of the above step (6-8), except that the new prompt word in step (6-8) is replaced by the current prompt word obtained in step (6-6), which will not be repeated here.
[0189] (6-10) The score of the current prompt word obtained in step (6-9) and the score of the new prompt word obtained in step (6-8) are used as the prompt word with the higher score as the current prompt word obtained in step (6-5) (e.g. Figure 3 As shown), and use the current prompt word as the optimized prompt word for the f-th category in the training set;
[0190] (6-11) Set h = h + 1 and return to step (6-4);
[0191] (6-11) Set f=f+1 and return to step (6-2).
[0192] The advantage of the above steps (6-5) to (6-10) is that the use of evolutionary algorithms for crossover and mutation can effectively increase the richness and diversity of the prompt word information while retaining the original prompt word information. The use of the objective function to calculate the score of the prompt word can well measure whether the prompt word can increase the diversity of the generated image set, thereby iteratively selecting better prompt words, thereby obtaining prompt words that effectively increase the diversity of the generated image set.
[0193] (7) For each category in the training set, the optimized prompt word corresponding to the category of the extended picture set corresponding to the category obtained in step (6) is used as the final prompt word corresponding to the category.
[0194] Experimental results
[0195] The experimental environment for this invention uses an NVIDIA A100 GPU and the Pytorch framework to implement the algorithm. The specific settings are as follows: ChatGPT-4 is used as the large language model for the evolutionary algorithm, Stable-Diffusion-v1.5 is used as the large model for the text graph, prompt words are iteratively optimized for 10 rounds, the parameters scale and strength are set to 20 and 0.5 when generating images from the text graph, the batch size for training the ResNet50 model is set to 256, and the number of training rounds is set to 100.
[0196] In order to illustrate the effectiveness of the method of the present invention and the effect of optimizing the prompt words of the large model of the text graph based on the evolutionary algorithm, this experiment first trained the ResNet50 model on the original training dataset (without expansion), and then used ChatGPT-4 to generate prompt words, the evolutionary algorithm + reducing unexpected data to generate prompt words, the evolutionary algorithm + increasing diversity to generate prompt words, and other operations to obtain the prompt word expanded dataset. The ResNet50 model was trained based on the datasets with different prompt word expansions, and the test accuracy of the trained ResNet50 model was compared.
[0197] The calculation formula for the test accuracy of the ResNet50 model is:
[0198]
[0199] Where: C is the number of correct categories predicted by the ResNet50 model on the test set obtained in step (1), and N is the total number of samples in the test set.
[0200] The test accuracy reported here is the average accuracy of the test set in the last 5 rounds of training 100 rounds. The evaluation results of different experimental settings are shown in Table 1 below. The closer the test accuracy is to 100%, the better the classification performance of the trained ResNet50 model:
[0201] Table 1
[0202]
[0203]
[0204] In the above table, the first line is the test accuracy obtained by training using the original training set without expansion; the second line is the test accuracy obtained by training using the large language model ChatGPT-4 to generate the prompt word extended dataset, which serves as the control group; the third line is the test accuracy obtained by training with the optimized prompt word extended dataset obtained by the evolutionary algorithm and the operation of reducing the generation of unexpected images; the fourth line is the test accuracy obtained by training with the optimized prompt word extended dataset obtained by the evolutionary algorithm and the operation of increasing the diversity of generated images; the fifth line is the test accuracy obtained by training with the optimized prompt word extended dataset obtained by the evolutionary algorithm and the operations of reducing the generation of unexpected images and increasing the generation diversity.
[0205] As can be seen from the table above, the test accuracy using the original training set without any expansion is 48.45%. This indicates that without additional data augmentation or prompt word generation, the performance of the ResNet50 model is relatively low, possibly due to the size and diversity of the training data.
[0206] After using the large language model ChatGPT-4 to generate prompt words to expand the dataset, the test accuracy increased to 69.3%. This shows that the prompt words generated by the large language model ChatGPT-4 can effectively expand the dataset and improve the generalization and classification performance of the ResNet50 model, which is significantly improved compared to the original dataset.
[0207] By optimizing the prompt words based on the evolutionary algorithm and reducing the generation of unexpected images, the test accuracy was further improved to 72.4%. This indicates that by reducing the generation of unexpected images, data quality is improved, and irrelevant information, such as images not containing cats or dogs, is reduced, thus helping the ResNet50 model better learn effective features.
[0208] By optimizing the prompt word using an evolutionary algorithm and increasing the diversity of generated images, the test accuracy reached 71.3%. This indicates that increasing the diversity of generated images helps the ResNet50 model learn a wider range of features.
[0209] Combining the evolutionary algorithm with methods to reduce unexpected image generation and increase generation diversity further improved test accuracy to 73.90%. This demonstrates that optimizing both data quality and diversity can maximize the performance of the ResNet50 model and achieve optimal classification results.
[0210] It will be easily understood by those skilled in the art that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for optimizing prompt words in a large-scale cultural graph model based on an evolutionary algorithm, characterized in that: The steps include: (1) Obtain an image dataset, which includes a training set and a test set; (2) For each category in the training set obtained in step (1), use the ChatGPT-4 model to generate the corresponding prompt word for that category; (3) For each prompt word corresponding to the category obtained in step (2), sample prompt words are randomly sampled multiple times from the prompt word, and the multiple sample prompt words are input into the Wenshengtu macro model to obtain extended pictures of the categories corresponding to all sample prompt words. All the obtained extended pictures constitute the extended picture set corresponding to the category; (4) using an evolutionary algorithm to process the extended picture set corresponding to each category obtained in step (3) to obtain an optimized prompt word for the category corresponding to the extended picture set corresponding to the category; (5) For the optimized prompt words corresponding to the extended picture set corresponding to each category in the training set obtained in step (4), sampled prompt words are randomly sampled multiple times from the prompt words, and the obtained multiple sampled prompt words are input into the Wenshengtu macro model to obtain extended pictures of the categories corresponding to all the sampled prompt words, and all the obtained extended pictures constitute the extended picture set corresponding to the category; (6) using an evolutionary algorithm to process the extended picture set corresponding to each category in the training set obtained in step (5) to obtain an optimized prompt word corresponding to the category of the extended picture set corresponding to the category; (7) For each category in the training set, the optimized prompt word corresponding to the category of the extended picture set corresponding to the category obtained in step (6) is used as the final prompt word corresponding to the category.
2. The method for optimizing prompt words of a large model of a cultural graph based on an evolutionary algorithm according to claim 1, characterized in that: Step (4) specifically includes the following steps: (4-1) Set counter i=1; (4-2) Determine whether i is greater than the number of categories in the data set obtained in step (1). If so, the process ends; otherwise, proceed to step (4-3); (4-3) Set counter j = 1; (4-4) Determine whether j is greater than a preset number of iterations. If so, proceed to step (4-12); otherwise, proceed to step (4-5). The preset number of iterations ranges from 8 to 10. (4-5) Obtain the prompt word corresponding to the i-th category in the training set obtained in step (2) as the current prompt word; (4-6) Obtaining the unexpected picture set and the expected picture set corresponding to the i-th category in the training set from the extended picture set corresponding to the i-th category in the training set obtained in step (3); (4-7) Using an evolutionary algorithm to process the current prompt word obtained in step (4-5) to obtain a new prompt word; (4-8) using the unexpected image set corresponding to the i-th category in the training set obtained in step (4-6) to process the new prompt word obtained in step (4-7) to obtain a score for the new prompt word; (4-9) using the unexpected image set obtained in step (4-6) to process the current prompt word obtained in step (4-5) to obtain a score for the current prompt word; (4-10) The score of the current prompt word obtained in step (4-9) and the score of the new prompt word obtained in step (4-8) are used as the prompt word with the higher score as the current prompt word in step (4-5), and the current prompt word is used as the optimized prompt word for the i-th category in the training set; (4-11) Set j = j + 1 and return to step (4-4); (4-12) Set i=i+1 and return to step (4-2).
3. The method for optimizing prompt words of a large model of a cultural graph based on an evolutionary algorithm according to claim 2, characterized in that: Steps (4-6) are performed by checking each image in the extended image set corresponding to the i-th category in the training set. If there is a subject other than the cat or dog category in the image, the image is an unexpected image; otherwise, the image is an expected image. Steps (4-7) are specifically as follows: first, use the large language model ChatGPT-4 to perform a self-crossover operation on the current prompt word obtained in step (4-5) to obtain the cross-processed prompt word; then, use the large language model ChatGPT-4 to perform a mutation operation on the cross-processed prompt word to obtain a new prompt word.
4. The method for optimizing prompt words of a large model of a cultural graph based on an evolutionary algorithm according to claim 2 or 3, characterized in that: Steps (4-8) are specifically: Input the new prompt word obtained in steps (4-7) into the Wenshengtu model to generate an extended picture of the category corresponding to the prompt word, and repeat this process multiple times. The multiple extended pictures obtained constitute the extended picture set corresponding to the i-th category in the training set; Then, calculate the similarity between the unexpected image set obtained in steps (4-6) and the expanded image set corresponding to the i-th category in the training set: Where m∈[1, the total number of extended pictures N in the extended picture set corresponding to the i-th category in the training set g ], n∈[1, the total number of pictures in the unexpected picture set N d ], Represents the extended image set I corresponding to the i-th category in the training set g The mth picture in Represents the unexpected picture set I obtained in steps (4-6) c The nth picture in N g Indicates the number of extended images in the extended image set corresponding to the i-th category in the training set, N d Indicates the number of unexpected images in the unexpected image set. Represents the extended image set I corresponding to the i-th category in the training set g The mth picture in and unexpected picture collection I c The nth picture in , and there are: in and They represent the feature vector of the mth picture in the extended picture set corresponding to the i-th category in the training set and the feature vector of the nth picture in the unexpected picture set, respectively. and Respectively represent the feature vector of the mth picture in the extended picture set corresponding to the i-th category in the training set The Euclidean norm of and the feature vector of the nth picture in the unexpected picture set The Euclidean norm of the training set is the feature vector of the mth picture in the extended picture set corresponding to the i-th category is extracted by contrastive language-image pre-training CLIP and is equal to: Where Embedding represents the visual encoder of CLIP; Then, the similarity between the expected image set obtained in steps (4-6) and the extended image set corresponding to the i-th category in the training set is calculated: Where: N c Represents the total number of images of the i-th category in the training set; Then, the confidence of the expanded image set corresponding to the i-th category in the training set is calculated: in Represents the extended image set I corresponding to the i-th category in the training set g The confidence of the mth image in is equal to: Where p represents the extended image set I corresponding to the i-th category in the training set by the CLIP model. g The mth picture The predicted probability distribution of is equal to: p=[p1,p2,...,p T ] Where T is the number of categories of images in the dataset (10 in this example), p k is the extended image set I corresponding to the i-th category in the ResNet50 model prediction training set g The mth picture The probability of belonging to the kth class, where k∈[1,T]; Finally, the similarity between the unexpected image set and the extended image set corresponding to the i-th category in the training set, the similarity between the expected image set and the extended image set corresponding to the i-th category in the training set, and the confidence of the extended image set corresponding to the i-th category in the training set are added together to obtain the score of the new prompt word, that is:
5. The method for optimizing prompt words of a large model of a cultural graph based on an evolutionary algorithm according to claim 4 is characterized in that: Step (6) specifically includes the following sub-steps: (6-1) Set counter f = 1; (6-2) Determine whether f is greater than the number of categories in the data set obtained in step (1). If so, the process ends; otherwise, proceed to step (6-3). (6-3) Set counter h = 1; (6-4) Determine whether h is greater than the preset number of iterations. If so, proceed to step (6-12); otherwise, proceed to step (6-5); (6-5) Obtain the optimized prompt word of the category corresponding to the extended picture set corresponding to the f-th category in the training set obtained in step (4) as the current prompt word; (6-6) Obtain a set of images lacking diversity from the expanded set of images corresponding to the f-th category in the training set obtained in step (5); (6-7) Using an evolutionary algorithm to process the current prompt word obtained in step (6-5) to obtain a new prompt word; (6-8) using the image set lacking diversity obtained in step (6-6) to process the new prompt word obtained in step (6-7) to obtain a score for the new prompt word; (6-9) using the image set lacking diversity obtained in step (6-6) to process the current prompt word obtained in step (6-5) to obtain a score for the current prompt word; (6-10) The score of the current prompt word obtained in step (6-9) and the score of the new prompt word obtained in step (6-8) are used as the prompt word with the higher score as the current prompt word obtained in step (6-5), and the current prompt word is used as the optimized prompt word for the f-th category in the training set; (6-11) Set h = h + 1 and return to step (6-4); (6-11) Set f=f+1 and return to step (6-2).
6. The method for optimizing prompt words of a large model of a cultural graph based on an evolutionary algorithm according to claim 5, characterized in that: Step (6-6) is to check each picture in the extended picture set corresponding to the f-th category in the training set. If the similarity between the picture and the picture corresponding to the f-th category in the training set obtained in step (1) is high, that is, the similarity between the picture and the picture corresponding to the f-th category in the training set reaches a preset threshold, it means that the picture has not expanded new information and the picture is a picture lacking diversity.
7. The method for optimizing prompt words of a large model of a cultural graph based on an evolutionary algorithm according to claim 6 is characterized in that: Steps (6-8) are specifically: First, the new prompt word obtained in steps (6-7) is input into the Wenshengtu model to generate an extended picture of the category corresponding to the prompt word. This process is repeated multiple times. The multiple extended pictures obtained constitute the extended picture set corresponding to the f-th category in the training set. Then, calculate the diversity index S of the extended image set corresponding to the fth category in the training set div (I l ): Among them I l represents the extended image set corresponding to the f-th category in the training set, M is the total number of images in the extended image set corresponding to the f-th category in the training set, v′ q is the feature vector of the qth picture in the extended picture set corresponding to the fth category in the training set, where q∈[1,M], is the average feature vector of all images in the extended image set corresponding to the f-th category in the training set, and has: in Represents the distance between the feature vector of the qth picture in the extended picture set corresponding to the fth category in the training set and the average feature vector of all pictures in the extended picture set corresponding to the fth category in the training set: Then, calculate the similarity between the image set lacking diversity and the expanded image set corresponding to the f-th category in the training set: Where: N a Represents the total number of images in the image set that lacks diversity, r∈[1, the total number of extended images in the extended image set corresponding to the f-th category in the training set N l ], e∈[1, the total number of pictures in the lack of diversity picture set N a ], Represents the extended image set I corresponding to the fth category in the training set l The rth picture in Represents the lack of diversity image set I obtained in step (6-6) s The e-th picture in ; Then, the confidence of the expanded image set corresponding to the f-th category in the training set is calculated: Finally, the diversity index of the extended image set corresponding to the f-th category in the training set, the similarity between the image set lacking diversity and the extended image set corresponding to the f-th category in the training set, and the confidence of the extended image set corresponding to the f-th category in the training set are added together to obtain the score of the new prompt word, that is:
8. A large-scale model prompt word optimization system for cultural graphs based on evolutionary algorithms, characterized by: include: The first module is used to obtain a data set, which includes a training set and a test set; The second module is used to generate the corresponding prompt word for each category in the training set obtained in the first module using the ChatGPT-4 model; The third module is configured to randomly sample multiple prompt words from each category obtained in the second module to obtain sampled prompt words, and input the obtained sampled prompt words into the Wenshengtu macro model to obtain extended images of the categories corresponding to all sampled prompt words. All obtained extended images constitute an extended image set corresponding to the category; The fourth module is used to process the extended picture set corresponding to each category obtained by the third module using an evolutionary algorithm to obtain an optimized prompt word for the category corresponding to the extended picture set corresponding to the category; The fifth module is configured to randomly sample the optimized prompt words for the category corresponding to the extended image set corresponding to each category in the training set obtained in the fourth module multiple times to obtain sampled prompt words, and input the obtained multiple sampled prompt words into the Wenshengtu macro model to obtain extended images for the categories corresponding to all the sampled prompt words. All the obtained extended images constitute the extended image set corresponding to the category; The sixth module is used to process the extended picture set corresponding to each category in the training set obtained in the fifth module using an evolutionary algorithm to obtain an optimized prompt word corresponding to the category of the extended picture set corresponding to the category; The seventh module is used to use, for each category in the training set, the optimized prompt words corresponding to the category of the extended picture set corresponding to the category obtained in the sixth module as the final prompt words corresponding to the category.
Citation Information
Patent Citations
Key test case generalization method for automatic driving visual target detection
CN118506133A
Intelligent layout design method of curvilinearly stiffened structures based on image feature learning
US20220138582A1