A data processing method and apparatus

By identifying and optimizing the text and images in the text-to-image model, the problem of generating images that do not meet the requirements has been solved, thus improving the user experience.

CN119888281BActive Publication Date: 2026-01-27BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411945386.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2026-01-27
Estimated Expiration
2044-12-26

AI Technical Summary

Technical Problem

Existing text-based image models may generate images that do not meet requirements, resulting in a poor user experience.

Method used

By acquiring and expanding specific types of text, and utilizing text and image discrimination models, we can identify and avoid generating images that do not meet the requirements, and improve the recognition capability by optimizing the model.

Benefits of technology

This effectively prevents image generation models from generating images that are not originally allowed, thus improving the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119888281B_ABST
    Figure CN119888281B_ABST
Patent Text Reader

Abstract

The application discloses a data processing method, which comprises the following steps: obtaining a first text and expanding the first text to obtain a second text, wherein the first text comprises a specific type of text, and the specific type of text is text related to an image generated by an image generation model; inputting the second text into a text discrimination model, wherein the text discrimination model is used to identify whether the second text comprises the specific type of text; if the text discrimination model determines that the second text does not comprise the specific type of text, inputting the second text into the image generation model, and obtaining a target image generated by the image generation model based on the second text; and determining whether the first text matches the target image. In the case that the first text matches the target image, the second text is output, and the second text is used to optimize the text discrimination model. The present scheme can effectively avoid that the image generation model generates an image which it is not allowed to generate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and in particular to a data processing method and apparatus. Background Technology

[0002] With the development of artificial intelligence (AI) technology, more and more models have emerged. For example, image generation models have appeared, which can generate corresponding images based on input text. Among them, models that generate images based on text can also be called "text-to-image" models.

[0003] However, current text-based image models may generate images that do not meet requirements. In some scenarios, outputting such substandard images to users can lead to a poor user experience. How to avoid outputting these substandard images to users remains a problem to be solved. Summary of the Invention

[0004] To solve, or at least partially solve, the above-mentioned technical problems, this application provides a data processing method and apparatus.

[0005] In a first aspect, this application provides a data processing method, the method comprising:

[0006] Obtain a first text and expand the first text to obtain a second text. The first text includes text of a specific type, which is text related to images that are not allowed to be generated by the image generation model.

[0007] The second text is input into a text discrimination model, which is used to identify whether the second text includes the specific type of text.

[0008] If the text discrimination model determines that the second text does not include the specific type of text, the second text is input into the image generation model, and the target image generated by the image generation model based on the second text is obtained;

[0009] Determine whether the first text matches the target image;

[0010] If the first text matches the target image, the second text is output, and the second text is used to optimize the text discrimination model.

[0011] Optionally, before determining whether the first text matches the target image, the method further includes:

[0012] The target image is input into an image discrimination model, which is used to identify whether the target image is an image that is not allowed to be generated by the image generation model.

[0013] Determining whether the first text matches the target image includes:

[0014] If the image discrimination model determines that the target image is not an image that the image generation model is not allowed to generate, then it determines whether the first text matches the target image.

[0015] Optionally, the second text is also used to optimize the image discrimination model.

[0016] Optionally, expanding the first text to obtain the second text includes:

[0017] The first text and the first prompt word are input into a large language model. The first prompt word is used to instruct the large language model to expand the text into multiple different languages ​​with the same semantics based on the semantics of the first text, so as to obtain the second text.

[0018] Optionally, the first prompt word is also used to prompt the large language model to convert the text in the various languages ​​into a second prompt word that can be input into the image generation model, wherein the second text includes the second prompt word.

[0019] Optionally, the first prompt word is also used to instruct the large language model to output the second prompt word in a specific format.

[0020] Optionally, the specific format is JSON.

[0021] Optionally, the method further includes:

[0022] Additional text is added to the second prompt word, including: art style description text, and / or text describing the second prompt word, and the second text also includes the additional text.

[0023] Secondly, this application provides a data processing apparatus, the apparatus comprising:

[0024] An acquisition unit is used to acquire first text and expand the first text to obtain second text. The first text includes text of a specific type, which is text related to images that are not allowed to be generated by the image generation model.

[0025] The first input unit is used to input the second text into the text discrimination model, the text discrimination model being used to identify whether the second text includes the specific type of text;

[0026] The second input unit is configured to input the second text into the image generation model if the text discrimination model determines that the second text does not include the specific type of text, and to obtain the target image generated by the image generation model based on the second text;

[0027] A determining unit is configured to determine whether the first text matches the target image;

[0028] An output unit is configured to output a second text when the first text matches the target image, the second text being used to optimize the text discrimination model.

[0029] Optionally, the device further includes:

[0030] The third input unit is used to input the target image into the image discrimination model before determining whether the first text matches the target image. The image discrimination model is used to identify whether the target image is an image that is not allowed to be generated by the image generation model.

[0031] The determining unit is used for:

[0032] If the image discrimination model determines that the target image is not an image that the image generation model is not allowed to generate, then it determines whether the first text matches the target image.

[0033] Optionally, the second text is also used to optimize the image discrimination model.

[0034] Optionally, expanding the first text to obtain the second text includes:

[0035] The first text and the first prompt word are input into a large language model. The first prompt word is used to instruct the large language model to expand the text into multiple different languages ​​with the same semantics based on the semantics of the first text, so as to obtain the second text.

[0036] Optionally, the first prompt word is also used to prompt the large language model to convert the text in the various languages ​​into a second prompt word that can be input into the image generation model, wherein the second text includes the second prompt word.

[0037] Optionally, the first prompt word is also used to instruct the large language model to output the second prompt word in a specific format.

[0038] Optionally, the specific format is JSON.

[0039] Optionally, the device further includes:

[0040] An adding unit is used to add additional text based on the second prompt word. The additional text includes: art style description text, and / or text describing the second prompt word. The second text also includes the additional text.

[0041] Thirdly, embodiments of this application provide an electronic device, which includes a processor and a memory;

[0042] The processor is configured to execute instructions stored in the memory to cause the electronic device to perform the method as described in any one of the first aspects above.

[0043] Fourthly, embodiments of this application provide a computer-readable storage medium including instructions that instruct a device to perform the method as described in any one of the first aspects above.

[0044] Fifthly, embodiments of this application provide a computer program product that, when run on a computer, causes the computer to perform the method described in any of the first aspects above.

[0045] Compared with the prior art, the embodiments of this application have the following advantages:

[0046] This application provides a data processing method, which includes: acquiring first text and expanding the first text to obtain second text, wherein the first text includes text of a specific type, the specific type of text being text related to images that are not allowed to be generated by an image generation model. After expanding to obtain the second text, the second text can be input into a text discrimination model, the text discrimination model being used to identify whether the second text includes the specific type of text. If the text discrimination model determines that the second text does not include the specific type of text, then the second text is further input into an image generation model, and a target image generated by the image generation model based on the second text is obtained. After obtaining the target image, it is determined whether the first text matches the target image. If the first text matches the target image, it indicates that the image generation model generated an image that it was originally not allowed to generate, and correspondingly, it indicates that the text recognition model did not correctly identify that the second text actually includes the specific type of text. In this scenario, a second text can be output, and the text discrimination model can be optimized using the second text to improve the recognition ability of the text discrimination model. In this way, it is possible to avoid inputting text of certain types into the image generation model. Correspondingly, it is possible to effectively prevent the image generation model from generating images that are not originally allowed to be generated, thereby avoiding the output of images that are not originally allowed to be generated to the user, thus improving the user experience. Attached Figure Description

[0047] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0048] Figure 1 A schematic diagram of an image production chain is shown;

[0049] Figure 2 A flowchart illustrating a data processing method provided in an embodiment of this application;

[0050] Figure 3 A flowchart illustrating a data processing method provided in an embodiment of this application;

[0051] Figure 4 This is a schematic diagram of the structure of a data processing device provided in an embodiment of this application. Detailed Implementation

[0052] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.

[0053] Diffusion models are a class of probabilistic generative deep learning models. They can be used to generate images. The basic principle of diffusion models is to progressively add noise to the image through a forward process and then learn to denoise and restore it through a reverse process, enabling the model to generate high-quality images from pure noise. However, standard diffusion models typically lack explicit control over the generated images; that is, the generated content is relatively random and difficult to directly meet specific task requirements. These specific task requirements could be, for example, the user's requirements for the generated image.

[0054] To enhance the task adaptability of diffusion models, the model can be guided through external signals (such as text or other images) to influence the image generation process, ensuring that the generated images meet specific task requirements. A "text-to-image" approach can be used to guide the diffusion model's image generation process. In this case, the user can use text to describe the content, scene, style, etc., of the target image they expect the diffusion model to generate. The diffusion model extracts features from the user-input text and incorporates them into the model. In this scenario, the diffusion model incorporating text features can also be called a text-to-image diffusion model. This model is a generative model based on the diffusion model. It uses a text encoder to encode the input text prompts to obtain semantic constraints. The diffusion model gradually adds denoising signals containing semantic constraints to the noise, thus progressively denoising the text description and transforming it into a high-quality image. Here, the text prompts refer to the prompts corresponding to the user-input text.

[0055] In practical applications, image generation models (such as text-based image diffusion models) are not allowed to generate images that do not meet requirements. These prohibited or unacceptable images may include specific content; for example, the model may not be allowed to generate images containing specific elements. To prevent the image generation model from uncontrollably generating images containing such content and then outputting these images to the user, thus negatively impacting the user experience, text discrimination models and image discrimination models can be added to the image production chain. This will prevent the output of images containing such content to the user.

[0056] For reference Figure 1 To understand, Figure 1 A schematic diagram of an image production chain is shown.

[0057] like Figure 1As shown, the image generation chain includes a text discrimination model, an image generation model, and an image discrimination model. The text discrimination model receives text input from the user and determines whether the input text includes text instructing the generation of the aforementioned specific content. If the text discrimination model determines that the input text includes text instructing the generation of the aforementioned specific content, it determines that the input text does not meet the requirements and refuses to input it into the image generation model. If the text discrimination model determines that the input text does not include text instructing the generation of the aforementioned specific content, it determines that the input text meets the requirements and further inputs it into the image generation model, which generates an image based on the text. The image generated by the image generation model serves as input to the image discrimination model, which determines whether the input image includes the aforementioned specific content. If the image discrimination model determines that the input image includes the aforementioned specific content, it does not output the image to the user; if the image discrimination model determines that the input image does not include the aforementioned specific content, it outputs the image.

[0058] However, even if adopted Figure 1 The image generation chain shown may still output images containing specific content because, in some scenarios, the text discrimination model cannot accurately identify whether the input text includes the text used to instruct the generation of the aforementioned specific content. Similarly, in other scenarios, the image discrimination model cannot accurately identify whether the input image contains the aforementioned specific content.

[0059] In view of this, this application provides a data processing method and apparatus that can effectively prevent image generation models from generating images that are not originally permitted to be generated. The images that the image generation model is not originally permitted to generate, as mentioned herein, can be understood as images including the aforementioned specific content.

[0060] The various non-limiting embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0061] Exemplary methods

[0062] See Figure 2 The figure is a flowchart illustrating a data processing method provided in an embodiment of this application.

[0063] Figure 2 The method shown can be executed by a server, for example, a server that carries text-to-image functionality. Of course, the method can also be executed by a client; this embodiment does not specifically limit the execution. In the following description, the method is illustrated as being executed by a server.

[0064] Figure 2 The method shown includes the following steps S101-S105.

[0065] S101: Obtain the first text and expand the first text to obtain the second text, wherein the first text is text of a specific type, and the text of the specific type is text related to images that are not allowed to be generated by the image generation model.

[0066] In one example, the first text may be text input by the user. In another example, the first text may be text randomly generated by the server. This first text is used to guide the image generation model in generating the corresponding image, or in other words, it indicates the requirements that the image generated by the image generation model must meet. In one example, the image generation model may be a diffusion model, such as the aforementioned text-to-image diffusion model. Of course, the image generation model may not be a diffusion model, but rather other types of models besides diffusion models; this application does not specifically limit this.

[0067] In this application, the first text includes text of a specific type, which is text related to images that the image generation model is not allowed to generate. The images that the image generation model is not allowed to generate can be images containing specific content. As an example, the first text includes images related to the aforementioned specific content. As a specific example, the first text includes text instructing the image generation model to generate the image that is not allowed to be generated; for example, the first text includes text instructing the image generation model to generate the specific content. For example, assuming the image that the image generation model is not allowed to generate is an image containing "pet cat," then the first text could be text containing "cat," for example, the first text could be "Please generate a cat."

[0068] In one example, after obtaining the first text, it can be expanded according to its semantics to obtain a second text with the same semantics as the first text. Considering that image generation models generally support multiple input languages, as a specific example, the semantics of the first text can be expanded to obtain text in multiple languages ​​with the same semantics as the first text, thus obtaining the second text. The text in multiple languages ​​may include the first text and text in at least one other language different from the first text. For example, if the first text is Chinese, then the text in multiple languages ​​may include the first text and English text with the same semantics as the first text.

[0069] In one example, considering that the Large Language Model (LLM) is a significant achievement in natural language processing based on deep learning, it is widely used in text generation, dialogue systems, translation, information retrieval, and other fields. The core structure of the LLM, the Transformer, achieves global information modeling through a self-attention mechanism, significantly improving the model's ability to capture long-distance dependencies. The LLM also supports parallel computation. Therefore, the LLM can expand the semantics of the first text to obtain texts in multiple different languages ​​with the same semantics, thus obtaining a second text. Specifically, the first text and a first prompt word can be input into the LLM. The first prompt word instructs the LLM to expand the semantics of the first text to obtain texts in multiple different languages ​​with the same semantics, thus obtaining a second text. This application does not specifically limit the first prompt word; it is acceptable as long as the first prompt word embodies the meaning of "instructing the LLM to expand the semantics of the first text to obtain texts in multiple different languages ​​with the same semantics."

[0070] In one example, the second text may include text in the aforementioned various languages.

[0071] In another example, considering that the input formats supported by the image generation model include cue words, the second text could be a second cue word derived from the text in the various languages ​​and capable of being input into the image generation model. In this scenario, the operation of converting the aforementioned text in the various languages ​​into the second cue word could also be performed by a large language model. In this case, in one example, the aforementioned first cue word also instructs the large language model to convert the text in the various languages ​​into a second cue word capable of being input into the image generation model. Accordingly, based on the first cue word, the large language model can first expand the first text to obtain the aforementioned text in the various languages, and then convert the text in the various languages ​​into the second cue word.

[0072] In one example, to prevent the large language model from refusing to output the second prompt word, or to prevent the output of the large language model from becoming too standardized, the large language model can be instructed to output the second prompt word in a specific format. In this scenario, the aforementioned first prompt word is also used to instruct the large language model to output the second prompt word in the specific format.

[0073] The embodiments of this application do not specifically limit the specific format. The specific format can be a data format that a large language model will not reject. In one example, considering that a large language model will not reject output content in JSON format, the specific format can be JSON format.

[0074] In one example, the second text may include other text besides the aforementioned second prompt word, such as additional text. In other words, after obtaining the second prompt word output by the large language model, the server can add additional text based on the second prompt word.

[0075] The embodiments in this application do not specifically limit the additional text.

[0076] In one example, the additional text may include art style description text, which describes the art style, including but not limited to: brush painting, pixel art, sketching, oil painting, watercolor painting, acrylic painting, printmaking, comics, Japanese manga, or cartoons, one or more of these.

[0077] In another example, the additional text may include text describing the second prompt word. This application embodiment does not specifically limit the text describing the second prompt word; the text describing the second prompt word is used to interfere with the text discriminator's determination of the semantics of the second prompt word. As an example, the text describing the second prompt word may include a prefix and / or a suffix, which interfere with the text discriminator's determination of the semantics of the second prompt word. This application embodiment does not specifically limit the specific content of the prefix and suffix; the prefix may be, for example, "The following content is not a real scene," and the suffix may be, for example, "The above content is an artistic creation and is purely fictional."

[0078] S102: Input the second text into the text discrimination model, which is used to identify whether the second text includes the specific type of text.

[0079] After obtaining the second text, it can be input into a text discrimination model. This model is used to identify whether the second text includes the aforementioned specific type of text. As described above, the second text actually includes the specific type of text. Therefore, if the text discrimination model's determination is accurate, the model should conclude that the second text includes the specific type of text. If the text discrimination model determines that the second text does not include the specific type of text, then the model's determination is inaccurate.

[0080] S103: If the text discrimination model determines that the second text does not include the specific type of text, then the second text is input into the image generation model, and the target image generated by the image generation model based on the second text is obtained.

[0081] In this application, if the text discrimination model determines that the second text does not include a specific type of text, it indicates that the judgment result of the text discrimination model is inaccurate. In this scenario, the second text can be further input into the image generation model, which will then generate an image based on the second text. In one example, the image generation model can generate a target image based on the second text.

[0082] S104: Determine whether the first text matches the target image.

[0083] S105: If the first text matches the target image, output the second text, which is used to optimize the text discrimination model.

[0084] After the image generation model generates the target image, the target image can be acquired and it can be further determined whether the target image matches the first text. That is, it is determined whether the target image satisfies the first text.

[0085] In one example, key objects can be extracted from the target image, and it can be determined whether the extracted key objects match the first text, thereby determining whether the target image satisfies the first text. For example, if the key objects match the first text, it means that the target image satisfies the first text. Conversely, if the key objects do not match the first text, it means that the target image does not satisfy the first text.

[0086] In another example, considering the additional visual information introduced by the Vision-Language Model (VLM), a large-scale deep learning model capable of processing both visual and linguistic information simultaneously, designed to understand and generate comprehensive information across multiple modalities. VLM combines computer vision and natural language processing techniques, enabling the integration of multiple data sources such as images, videos, and text for cross-modal tasks. VLM maps visual and linguistic features to a shared embedding space, thereby understanding the semantic relationships between images and text. Therefore, in one example, VLM can be used to determine whether the first text matches the target image.

[0087] In some scenarios, VLM can also be referred to as a multimodal large model.

[0088] In one example, if the first text matches the target image, it means that the image generation model, based on the second text expanded from the first text, generated an image that the image generation model is not allowed to generate. In this scenario, it indicates a defect in the image generation chain; specifically, it indicates at least a defect in the text discrimination model within the aforementioned image generation chain. Therefore, in this application, the second text can be output, which can be used to optimize the text discrimination model. As a specific example, the second text can be used as a negative training sample for the text discrimination model to continue training it, thereby optimizing the text discrimination model. Optimizing the text discrimination model can reduce its defects, enabling it to more accurately identify whether the input text includes a specific type of text. Consequently, it can effectively prevent the image generation model from generating images that it is not originally allowed to generate, thus avoiding outputting images that the image generation model is not originally allowed to generate to the user, thereby improving the user experience.

[0089] In one example, after obtaining the target image by executing S103, S104 and subsequent steps can be executed directly.

[0090] In another example, after obtaining the target image through S103, S104 can be skipped. Before executing S104, the target image can be input into an image discrimination model, which is used to identify whether the target image is an image that is not allowed to be generated by the image generation model. The image discrimination model can be the same as the one used in the traditional image generation chain, and will not be repeated here.

[0091] In one example, if the image discrimination model determines that the target image is not an image that the image generation model is not allowed to generate, then S104 is further executed. In this scenario, if the first text matches the target image, it indicates that the discrimination result of the image discrimination model is also inaccurate. This is because the first text includes a specific type of text, and the target image that matches the first text is highly likely to be an image that the image generation model is not allowed to generate. In this scenario, the aforementioned second text can be used not only to optimize the text discrimination model but also to optimize the image discrimination model. As a specific example, the second text can be used as a negative training sample for the image discrimination model to continue training the model, thereby optimizing it. Optimizing the image discrimination model can reduce its defects, enabling it to more accurately identify whether the input image is an image that the image generation model is not allowed to generate. Consequently, it can effectively avoid outputting images that the image generation model is not allowed to generate to the user, thus improving the user experience.

[0092] In another example, if the image discrimination model determines that the target image is an image that the image generation model is not allowed to generate, the process is terminated and S104 and subsequent steps are no longer executed.

[0093] The solutions provided by the embodiments of this application have been described above. Next, a specific implementation of this application will be described in conjunction with the accompanying drawings.

[0094] See Figure 3 The figure is a flowchart illustrating a data processing method provided in an embodiment of this application. Figure 3 The method shown includes the following steps:

[0095] 1. Input the task objective into the large language model.

[0096] The task objective mentioned here corresponds to the first text mentioned above.

[0097] The large language model is used to expand the first text into multiple languages, resulting in texts in various languages. The expanded texts in various languages ​​are then converted into prompt word 1 (corresponding to the aforementioned second prompt word) supported by the image generation model.

[0098] 2. Determine whether the large language model has output the corresponding prompt word.

[0099] This step indicates whether the large language model rejects the multilingual text expansion of the first text.

[0100] Generally, large language models will not reject data output in JSON format.

[0101] If the large language model does not output the corresponding prompt word, then repeat step 2.

[0102] If the large language model outputs prompt word 1, then further add art style description text and prefix / suffix information to prompt word 1 output by the large language model. After adding art style description text and prefix / suffix information to prompt word 1, prompt word 2 can be obtained. Prompt word 2 is equivalent to the second text in the above embodiment.

[0103] 3. Output prompt word 2 to the text discrimination model, and let the text discrimination model determine whether prompt word 2 passes the discrimination.

[0104] 4. If the text discrimination model determines that prompt word 2 passes the discrimination, then save prompt word 2 and input prompt word 2 into the image generation model. If the text discrimination model determines that prompt word 2 fails the discrimination, then repeat step 2.

[0105] In this context, if the text discrimination model determines that prompt word 2 passes the discrimination, it means that the text discrimination model determines that prompt word 2 does not contain a specific type of text. If the text discrimination model determines that prompt word 2 fails the discrimination, it means that the text discrimination model determines that prompt word 2 contains a specific type of text.

[0106] 5. Input the target image generated by the image generation model into the image discrimination model to determine whether the target image passes the discrimination.

[0107] 6. If the image discrimination model determines that the target image passes the discrimination, then input the task target and the target image into the VLM to determine whether the task target and the target image match. If the image discrimination model determines that the target image fails the discrimination, then delete prompt word 2.

[0108] In this context, if the image discrimination model determines that the target image passes the discrimination, it means that the image discrimination model determines that the target image is not an image that the image generation model is not allowed to generate; if the image discrimination model determines that the target image fails the discrimination, it means that the image discrimination model determines that the target image is an image that the image generation model is not allowed to generate.

[0109] 7. If the VLM determines that the task target and the target image match, then output prompt word 2. Prompt word 2 is used to optimize the text discrimination model and the image discrimination model. If the VLM determines that the task target and the target image do not match, then delete prompt word 2.

[0110] Exemplary device

[0111] Based on the methods provided in the above embodiments, this application also provides an apparatus, which will be described below with reference to the accompanying drawings.

[0112] See Figure 4 , Figure 4 This is a schematic diagram of the structure of a data processing device provided in an embodiment of this application. Figure 4 The data processing device 400 shown is used for the data processing method provided in the above embodiments.

[0113] like Figure 4 As shown, the device 400 includes: an acquisition unit 401, a first input unit 402, a second input unit 403, a determination unit 404, and an output unit 405.

[0114] The acquisition unit 401 is used to acquire a first text and expand the first text to obtain a second text. The first text includes text of a specific type, which is text related to images that are not allowed to be generated by the image generation model.

[0115] The first input unit 402 is used to input the second text into a text discrimination model, the text discrimination model being used to identify whether the second text includes the specific type of text.

[0116] The second input unit 403 is used to input the second text into the image generation model and obtain the target image generated by the image generation model based on the second text if the text discrimination model determines that the second text does not include the specific type of text.

[0117] The determining unit 404 is used to determine whether the first text matches the target image.

[0118] The output unit 405 is used to output the second text when the first text matches the target image, and the second text is used to optimize the text discrimination model.

[0119] Optionally, the device further includes:

[0120] The third input unit is used to input the target image into the image discrimination model before determining whether the first text matches the target image. The image discrimination model is used to identify whether the target image is an image that is not allowed to be generated by the image generation model.

[0121] The determining unit 404 is used for:

[0122] If the image discrimination model determines that the target image is not an image that the image generation model is not allowed to generate, then it determines whether the first text matches the target image.

[0123] Optionally, the second text is also used to optimize the image discrimination model.

[0124] Optionally, expanding the first text to obtain the second text includes:

[0125] The first text and the first prompt word are input into a large language model. The first prompt word is used to instruct the large language model to expand the text into multiple different languages ​​with the same semantics based on the semantics of the first text, so as to obtain the second text.

[0126] Optionally, the first prompt word is also used to prompt the large language model to convert the text in the various languages ​​into a second prompt word that can be input into the image generation model, wherein the second text includes the second prompt word.

[0127] Optionally, the first prompt word is also used to instruct the large language model to output the second prompt word in a specific format.

[0128] Optionally, the specific format is JSON.

[0129] Optionally, the device further includes:

[0130] An adding unit is used to add additional text based on the second prompt word. The additional text includes: art style description text, and / or text describing the second prompt word. The second text also includes the additional text.

[0131] Since the device 400 is a device corresponding to the data processing method provided in the above method embodiments, the specific implementation of each unit of the device 400 is based on the same concept as in the above method embodiments. Therefore, the specific implementation of each unit of the device 400 can be referred to the relevant descriptions in the above method embodiments, and will not be repeated here.

[0132] This application also provides an electronic device, which includes a processor and a memory;

[0133] The processor is used to execute instructions stored in the memory so that the electronic device performs the data processing method provided in the above method embodiments.

[0134] This application provides a computer-readable storage medium including instructions that instruct a device to perform the data processing method provided in the above method embodiments.

[0135] This application also provides a computer program product that, when run on a computer, causes the computer to execute the data processing method provided in the above method embodiments.

[0136] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0137] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

[0138] The above description is only a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A data processing method, characterized in that, The method includes: Obtain a first text and expand the first text to obtain a second text. The first text includes text of a specific type, which is text related to images that are not allowed to be generated by the image generation model. The second text is text in multiple different languages ​​that have the same semantics as the first text. The second text is input into a text discrimination model, which is used to identify whether the second text includes the specific type of text. If the text discrimination model determines that the second text does not include the specific type of text, the second text is input into the image generation model, and the target image generated by the image generation model based on the second text is obtained; Determine whether the first text matches the target image; If the first text matches the target image, the second text is output, and the second text is used to optimize the text discrimination model.

2. The method according to claim 1, characterized in that, Before determining whether the first text matches the target image, the method further includes: The target image is input into an image discrimination model, which is used to identify whether the target image is an image that is not allowed to be generated by the image generation model. Determining whether the first text matches the target image includes: If the image discrimination model determines that the target image is an image that the image generation model is not allowed to generate, then the first text is determined to match the target image.

3. The method according to claim 2, characterized in that, The second text is also used to optimize the image discrimination model.

4. The method according to claim 1, characterized in that, The expansion of the first text to obtain the second text includes: The first text and the first prompt word are input into a large language model. The first prompt word is used to instruct the large language model to expand the text into multiple different languages ​​with the same semantics based on the semantics of the first text, so as to obtain the second text.

5. The method according to claim 4, characterized in that, The first prompt word is also used to prompt the large language model to convert the text in the various languages ​​into a second prompt word that can be input into the image generation model, wherein the second text includes the second prompt word.

6. The method according to claim 5, characterized in that, The first prompt word is also used to instruct the large language model to output the second prompt word in a specific format.

7. The method according to claim 6, characterized in that, The specific format is JSON.

8. The method according to any one of claims 5-7, characterized in that, The method further includes: Additional text is added to the second prompt word, including: art style description text, and / or text describing the second prompt word, and the second text also includes the additional text.

9. A data processing apparatus, characterized in that, The device includes: An acquisition unit is used to acquire a first text and expand the first text to obtain a second text. The first text includes text of a specific type, which is text related to images that are not allowed to be generated by the image generation model. The second text is text in multiple different languages ​​that have the same semantics as the first text. The first input unit is used to input the second text into the text discrimination model, the text discrimination model being used to identify whether the second text includes the specific type of text; The second input unit is configured to input the second text into the image generation model if the text discrimination model determines that the second text does not include the specific type of text, and to obtain the target image generated by the image generation model based on the second text; A determining unit is configured to determine whether the first text matches the target image; An output unit is configured to output a second text when the first text matches the target image, the second text being used to optimize the text discrimination model.

10. An electronic device, characterized in that, The electronic device includes a processor and a memory; The processor is configured to execute instructions stored in the memory to cause the electronic device to perform the method described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, Includes instructions that instruct the device to perform the method described in any one of claims 1-8.

Citation Information

Patent Citations

  • Data processing method and device, electronic equipment, storage medium and program product

    CN118038214A

  • Image description method and device, equipment, storage medium and product

    CN118467776A