Automatic Chinese image-text pair data generation method and device based on LVLM
Through the automated Chinese image-text pair data generation method based on LVLM, the problem of low quality and small quantity of existing Chinese image-text pair data sets is solved, the construction of high-quality and diversified data sets is achieved, and the training effect of the model is improved. and generalization ability.
Patent Information
- Application Number
- CN202411052852.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-02
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-08-02
AI Technical Summary
The existing Chinese image and text data sets are of low quality and small in quantity, which results in limited model training effects and generalization capabilities. Moreover, the image and text topics in the data set are concentrated in specific fields and lack universality.
An automated Chinese image-text data generation method based on LVLM (CLIP and large-scale visual-language model) is used. By acquiring images and generating instructions, the LVLM model is used to generate text, truncate sample filtering and repeatability filtering, and the Chinese CLIP model is used to calculate the graph. Based on text similarity, the data is automatically filtered and cleaned to form a high-quality and diverse data set.
It improves the quality and quantity of Chinese graphics and text data, enhances the diversity and representativeness of the data, improves the understanding and generation capabilities of the model, and simplifies the data generation process.
Smart Images

Figure CN118570566A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of large language models, and in particular to a method and device for automatically generating Chinese image-text pair data based on LVLM. Background Art
[0002] In the field of artificial intelligence, multimodal data fusion technology, especially the combination of images and text, has become a research hotspot. This type of data not only enriches the input dimension of machine learning models, but also promotes the rapid development of deep learning in application fields such as visual question answering, image description generation, and visual positioning. Among them, the Chinese image-text pair dataset, as an important bridge connecting vision and semantics, is crucial to promoting multimodal understanding and generation research in the Chinese context.
[0003] Although many works have been devoted to creating Chinese image-text pair datasets in recent years, these datasets often have the following limitations: (1) Compared with the English field, high-quality and large-scale Chinese image-text pair datasets are relatively scarce, which limits the training effect and generalization ability of the model; (2) In the existing datasets, the matching degree of some image-text pairs is not high, and the text description may not match the image content, causing the model to learn incorrect associations; (3) The image and text topics in the dataset are often concentrated in certain specific fields, lacking breadth and representativeness, which affects the model's comprehensive understanding and generation capabilities.
[0004] In view of the above limitations, automated Chinese image-text pair data generation and cleaning technology came into being. This technology aims to automatically mine, match and clean Chinese image-text pair data from massive Internet resources through algorithms, in order to build a large-scale, high-quality, diverse and real-time updated dataset. Summary of the invention
[0005] The present invention provides an automatic Chinese image-text pair data generation method and device based on LVLM, so as to solve the problem that the Chinese data in the existing Chinese image-text pair data is of low quality and small quantity.
[0006] In the first aspect, the present invention provides a method and device for automatically generating Chinese image-text pair data based on LVLM (CLIP and Large Vision-Language Model), which is applicable to the case where only images are included, and specifically includes the following steps: Step S1, acquiring image D1 and generating instruction prompt-1; Step S2, input D1 and prompt-1 into the LVLM model to form text T1; Step S3, filtering the truncated samples of T1 to form text T2; Step S4, performing repetitive filtering on T2 to form text T3; Step S5: Calculate the similarity S-1 between D1 and T3 through the Chinese CLIP model. If S-1 is less than the threshold γ, delete D1; otherwise, retain D1.
[0007] Preferably, in step S1, the prompt-1 is used to guide the LVLM model to generate a specific type of response or perform a specific task.
[0008] Preferably, in step S3, perform truncated sample filtering on T1 to form T2, which specifically includes the following steps: Step S301: Judge the character length L of T1 T1 and the size of the character threshold max_new_tokens. If L T1 is less than max_new_tokens, set T2 as T1 and execute step S4; otherwise, truncate the characters in T1 that exceed max_new_tokens to form T1-truncate. Step S302: Judge whether the last character character-1 of T1-truncate is a Chinese full stop. If character-1 is a Chinese full stop, set T2 as T1-truncate; otherwise, delete the content after the last Chinese full stop in T1-truncate to form T2.
[0009] Preferably, in step S4, perform duplicate filtering on T2 to form T3, which specifically includes the following steps: Step S401: Divide T2 into L sentences to form the text T3. Step S402: Perform deduplication processing on T3 to obtain L' sentences after deduplication processing. Step S403: If L'<L, delete D1; otherwise, execute step S5.
[0010] Preferably, in step S402, perform the deduplication processing by performing set operations on the L sentences.
[0011] Preferably, when the computing resources are insufficient, remove step S5, directly retain the image D1 and output the text T3.
[0012] In a second aspect, the present invention provides an automated Chinese image-text pair data generation method based on LVLM, which is applicable to the case of including an image and an English description of the image, and specifically includes the following steps: Step A1: Obtain the image D2 and the English description D2-description of D2. Step A2: Calculate the similarity S-2 between D2 and D2-description using the Chinese CLIP model. If S-2 is less than the threshold γ, delete D2; otherwise, retain D2. Step A3: Generate the instruction prompt-2 and input prompt-2 and D2-description into the LVLM model to translate D2-description into Chinese, forming the text T4. Step A4: Perform truncated sample filtering on T4 to form the text T5. Step A5: Perform duplicate filtering on T5 to form the text T6.
[0013] Preferably, in step A4, performing truncated sample filtering on T4 to form the text T5 specifically includes the following steps: Step A401: Judge the character length L of T4 T4 and the size of the character threshold max_new_tokens. If L T4 is less than max_new_tokens, set T5 as T4 and execute step A5; otherwise, truncate the characters in T4 that exceed max_new_tokens to form T4-truncate. Step A402: Judge whether the last character character-2 of T4-truncate is a Chinese full stop. If character-2 is a Chinese full stop, set T5 as T4-truncate; otherwise, delete the content after the last Chinese full stop in T4-truncate to form T5.
[0014] Preferably, in step A5, performing duplicate filtering on T5 to form the text T6, the data processing method in step A5 specifically includes the following steps: Step A501: Divide T5 into N sentences to form the text T6. Step A502: Perform deduplication processing on T6 to obtain N' sentences after deduplication processing. Step A503: If N'<N, delete D2; otherwise, output the text T6.
[0015] Preferably, in step A502, the deduplication processing is implemented by performing set operations on the N sentences.
[0016] Preferably, when the computing resources are insufficient, delete step A2.
[0017] In a third aspect, the present invention provides an LVLM-based automated Chinese image-text pair data generation device applicable to the case of only containing images, specifically including the following modules: The first initialization module is used to obtain image D1 and generate instruction prompt-1; The first text generation module, connected to the first initialization module, is used to input D1 and prompt-1 into the LVLM model to form text T1; The first truncated sample filtering module, connected to the first text generation module, is used to perform truncated sample filtering on T1 to form text T2; The first duplicate filtering module, connected to the first truncated sample filtering module, is used to perform duplicate filtering on T2 to form text T3; The first sample processing module, connected to the first duplicate filtering module, is used to calculate the similarity S-1 between D1 and T3 through the Chinese CLIP model. If S-1 is less than the threshold γ, then D1 is deleted; otherwise, D1 is retained.
[0018] Preferably, in the first initialization module, the prompt-1 is used to guide the LVLM model to generate a specific type of response or perform a specific task.
[0019] Preferably, the first truncated sample filtering module specifically includes the following sub-modules: The first truncation sub-module is used to judge the character length L of T1 T1 and the size of the character threshold max_new_tokens. If L T1 is less than max_new_tokens, then T2 is set to T1 and the first duplicate filtering module is executed; otherwise, the characters in T1 that exceed max_new_tokens are truncated to form T1-truncate; The second truncation sub-module, connected to the first truncation sub-module, is used to judge whether the last character character-1 of T1-truncate is a Chinese full stop. If character-1 is a Chinese full stop, then T2 is set to T1-truncate; otherwise, the content after the last Chinese full stop in T1-truncate is deleted to form T2.
[0020] Preferably, the first duplicate filtering module specifically includes the following sub-modules: The first duplication sub-module is used to divide T2 into L sentences to form text T3; The second duplication sub-module, connected to the first duplication sub-module, is used to perform deduplication processing on T3 to obtain L' deduplicated sentences; The third duplication sub-module, connected to the second duplication sub-module, is used to delete D1 when L'<L; otherwise, the first sample processing module is executed.
[0021] Preferably, in the first repetitive submodule connection, the deduplication process is implemented by performing a set operation on L sentences.
[0022] The fourth aspect is an automatic Chinese image-text pair data generation device based on LVLM, which is suitable for the case of including an image and an English description of the image, and specifically includes the following modules: A second initialization module is used to obtain an image D2 and an English description D2-description of D2; A second sample processing module, connected to the second initialization module, is used to calculate the similarity S-2 between D2 and D2-description through the Chinese CLIP model, and if S-2 is less than a threshold γ, D2 is deleted, otherwise, D2 is retained; A second text generation module, connected to the second sample processing module, is used to generate instruction prompt-2 and input prompt-2 and D2-description into the LVLM model, and translate D2-description into Chinese to form text T4; A second truncated sample filtering module, connected to the second text generating module, for filtering the truncated samples of T4 to form text T5; The second repetitive filtering module is connected to the second truncated sample filtering module and is used to perform repetitive filtering on T5 to form text T6.
[0023] Preferably, the second truncated sample filtering module specifically includes the following submodules: The third truncation submodule is used to determine the character length L of T4 T4 With the size of the character threshold max_new_tokens, if L T4 If it is less than max_new_tokens, T5 is set to T4 and the second repetitive filtering module is executed. Otherwise, the characters in T4 exceeding max_new_tokens are truncated to form T4-truncate. The fourth truncation submodule is connected to the third truncation submodule and is used to determine whether the last character character-2 of T4-truncate is a Chinese period. If character-2 is a Chinese period, T5 is set to T4-truncate. Otherwise, the content after the last Chinese period in T4-truncate is deleted to form T5.
[0024] Preferably, the second repetitive filtering module specifically includes the following submodules: The fourth repetitive submodule is used to divide T5 into N sentences to form text T6; The fifth deduplication sub-module, connected to the fourth deduplication sub-module, is used to perform deduplication processing on T6 to obtain N' deduplicated sentences; The sixth deduplication sub-module, connected to the fifth deduplication sub-module, is used to delete D2 when N'<N, and vice versa, output text T6.
[0025] Preferably, in the fifth deduplication sub-module, the deduplication processing is implemented by performing a set operation on N sentences.
[0026] On the other hand, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements a method for generating automated Chinese image-text pair data based on LVLM according to any one of the first aspect or the second aspect of the present application.
[0027] On the other hand, the present invention also provides an electronic device. The electronic device includes: a memory storing a computer program; a processor communicatively connected to the memory, and when the computer program is called, it executes a method for generating automated Chinese image-text pair data based on LVLM according to any one of the first aspect or the second aspect of the present application.
[0028] Compared with the prior art, the present invention has the following obvious prominent substantial features and remarkable advantages: The present invention provides a method and device for generating automated Chinese image-text pair data based on LVLM, which solves the problems of low quality and small quantity of Chinese data in existing Chinese image-text pair data. It has the following advantages: (1) Using the same LVLM for generating Chinese data and translating English data simplifies the architecture of the solution; (2) By combining the two methods of generation and translation, the source of Chinese image-text data is expanded, and the diversity of data is increased; (3) The generated / translated samples are post-processed in multiple stages to further improve the quality of Chinese corpus; (4) Using the CLIP model to compare the similarity between images and texts further improves the quality of Chinese corpus. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The accompanying drawings forming a part of the present invention are used to provide a further understanding of the present invention. The schematic embodiments and descriptions thereof of the present invention are used to explain the present invention and do not constitute an improper limitation to the present invention. In the drawings: Figure 1 is a flowchart of a situation in a method for generating automated Chinese image-text pair data based on LVLM according to a preferred embodiment of the present invention.
[0030] Figure 2 is a flowchart of another situation in a method for generating automated Chinese image-text pair data based on LVLM according to a preferred embodiment of the present invention.
[0031] Figure 3 It is a structural schematic diagram of a situation in an automatic Chinese image-text data generation device based on LVLM in a preferred embodiment of the present invention.
[0032] Figure 4 It is a structural schematic diagram of another situation in an automatic Chinese image-text data generation device based on LVLM in a preferred embodiment of the present invention.
[0033] Figure 5 It is a flow chart of an automatic Chinese image-text pair data generation method based on LVLM according to a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0034] The present invention provides a method and device for automatically generating Chinese text-image data based on LVLM. In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0035] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices. Example
[0036] like Figure 1 and Figure 5 (left) shows that the method for generating Chinese image-text pair data based on LVLM described in this embodiment is applicable to the case where only images are included, and specifically includes the following steps: Step S1, obtain image D1 and generate instruction prompt-1, such as: please describe this picture.
[0037] Among them, the prompt-1 is used to guide the LVLM model to generate a specific type of response or perform a specific task.
[0038] Step S2: Input D1 and prompt-1 into the LVLM model to form text T1.
[0039] Step S3: truncate and filter samples of T1 to form text T2.
[0040] Optionally, step S3 specifically includes the following steps: Step S301, determine the character length L of T1 T1 and the size of the character threshold max_new_tokens. If L T1 is less than max_new_tokens, set T2 to T1 and execute step S4. Otherwise, truncate the characters in T1 that exceed max_new_tokens to form T1-truncate.
[0041] Step S302, determine whether the last character character-1 of T1-truncate is a Chinese full stop. If character-1 is a Chinese full stop, set T2 to T1-truncate. Otherwise, delete the content after the last Chinese full stop in T1-truncate to form T2.
[0042] Step S4, perform duplicate filtering on T2 to form text T3.
[0043] Optionally, step S4 specifically includes the following steps: Step S401, divide T2 into L sentences to form text T3.
[0044] Step S402, perform deduplication processing on T3 to obtain L' sentences after deduplication processing.
[0045] Optionally, the deduplication processing is implemented by performing a set operation on L sentences.
[0046] Step S403, if L'<L, delete D1. Otherwise, execute step S5.
[0047] Step S5, calculate the similarity S-1 between D1 and T3 through the Chinese CLIP model. If S-1 is less than the threshold γ, delete D1. Otherwise, retain D1. Embodiment
[0048] As Figure 2 and Figure 5 (right) shows, a method for automatically generating Chinese image-text pairs based on LVLM according to this embodiment is applicable to the situation including an image and an English description of the image, and specifically includes the following steps: Step S6, obtain the image D2 and the English description D2-description of D2.
[0049] Step S7, calculate the similarity S-2 between D2 and D2-description through the Chinese CLIP model. If S-2 is less than the threshold γ, delete D2. Otherwise, retain D2.
[0050] Step S8: Generate instruction prompt-2 (e.g., please translate it into Chinese) and input prompt-2 and D2-description into the LVLM model to translate D2-description into Chinese, forming text T4.
[0051] Step S9: Perform truncated sample filtering on T4 to form text T5.
[0052] Optionally, step S9 specifically includes the following steps: Step S901: Determine the character length L of T4 T4 and the size of the character threshold max_new_tokens. If L T4 is less than max_new_tokens, set T5 to T4 and execute step S10. Otherwise, truncate the characters in T4 that exceed max_new_tokens to form T4-truncate.
[0053] Step S902: Determine whether the last character character-2 of T4-truncate is a Chinese full stop. If character-2 is a Chinese full stop, set T5 to T4-truncate. Otherwise, delete the content after the last Chinese full stop in T4-truncate to form T5.
[0054] Step S10: Perform duplicate filtering on T5 to form text T6.
[0055] Optionally, step S10 specifically includes the following steps: Step S1001: Divide T5 into N sentences to form text T6.
[0056] Step S1002: Perform deduplication processing on T6 to obtain N' deduplicated sentences.
[0057] Optionally, the deduplication processing is implemented by performing set operations on N sentences.
[0058] Step S1003: If N'<N, delete D2. Otherwise, output text T6. Embodiment
[0059] As Figure 3 shown, an automated Chinese image-text pair data generation device based on LVLM described in this embodiment specifically includes the following modules: The first initialization module is used to obtain image D1 and generate instruction prompt-1.
[0060] The first text generation module, connected to the first initialization module, is used to input D1 and prompt-1 into the LVLM model to form text T1.
[0061] The first truncated sample filtering module, connected to the first text generation module, is used to perform truncated sample filtering on T1 to form text T2.
[0062] Among them, the first truncated sample filtering module specifically includes the following sub-modules: The first truncation sub-module is used to judge the character length L of T1 T1 And the size of the character threshold max_new_tokens. If L T1 Is less than max_new_tokens, then set T2 to T1 and execute the first duplicate filtering module. Otherwise, truncate the characters in T1 that exceed max_new_tokens to form T1-truncate.
[0063] The second truncation sub-module, connected to the first truncation sub-module, is used to judge whether the last character character-1 of T1-truncate is a Chinese full stop. If character-1 is a Chinese full stop, then set T2 to T1-truncate. Otherwise, delete the content after the last Chinese full stop in T1-truncate to form T2.
[0064] The first duplicate filtering module, connected to the first truncated sample filtering module, is used to perform duplicate filtering on T2 to form text T3.
[0065] Among them, the first duplicate filtering module specifically includes the following sub-modules: The first duplicate sub-module is used to divide T2 into L sentences to form text T3.
[0066] The second duplicate sub-module, connected to the first duplicate sub-module, is used to perform deduplication processing on T3 to obtain L' deduplicated sentences.
[0067] Optionally, the deduplication processing is implemented by performing a set operation on L sentences.
[0068] The third duplicate sub-module, connected to the second duplicate sub-module, is used to delete D1 when L' < L, otherwise, execute the first sample processing module.
[0069] The first sample processing module, connected to the first duplicate filtering module, is used to calculate the similarity S-1 between D1 and T3 through the Chinese CLIP model. If S-1 is less than the threshold γ, then delete D1. Otherwise, retain D1. Embodiment
[0070] like Figure 4 As shown, the automatic Chinese image-text pair data generation device based on LVLM described in this embodiment, for the case of including an image and an English description of the image, specifically includes the following modules: The second initialization module is used to obtain the image D2 and the English description D2-description of D2.
[0071] The second sample processing module is connected to the second initialization module and is used to calculate the similarity S-2 between D2 and D2-description through the Chinese CLIP model. If S-2 is less than a threshold γ, D2 is deleted; otherwise, D2 is retained.
[0072] The second text generation module is connected to the second sample processing module, and is used to generate instruction prompt-2 and input prompt-2 and D2-description into the LVLM model, and translate D2-description into Chinese to form text T4.
[0073] The second truncated sample filtering module is connected to the second text generating module and is used to perform truncated sample filtering on T4 to form text T5.
[0074] The second truncated sample filtering module specifically includes the following submodules: The third truncation submodule is used to determine the character length L of T4 T4 With the size of the character threshold max_new_tokens, if L T4 If it is less than max_new_tokens, T5 is set to T4 and the second repetitive filtering module is executed. Otherwise, the characters in T4 exceeding max_new_tokens are truncated to form T4-truncate.
[0075] The fourth truncation submodule is connected to the third truncation submodule and is used to determine whether the last character character-2 of T4-truncate is a Chinese period. If character-2 is a Chinese period, T5 is set to T4-truncate. Otherwise, the content after the last Chinese period in T4-truncate is deleted to form T5.
[0076] The second repetitive filtering module is connected to the second truncated sample filtering module and is used to perform repetitive filtering on T5 to form text T6.
[0077] Wherein, the second repetitive filtering module specifically includes the following submodules: The fourth repeating sub-module is used to divide T5 into N sentences to form text T6.
[0078] The fifth repeating sub-module, connected to the fourth repeating sub-module, is used to perform duplicate removal processing on T6 to obtain N' sentences after duplicate removal processing.
[0079] Optionally, the duplicate removal processing is implemented by performing a set operation on N sentences.
[0080] The sixth repeating sub-module, connected to the fifth repeating sub-module, is used to delete D2 when N'<N, and vice versa, output text T6.
[0081] The specific embodiments of the present invention have been described in detail above, but they are only examples, and the present invention is not limited to the specific embodiments described above. For those skilled in the art, any equivalent modifications and substitutions to the present invention are also within the scope of the present invention. Therefore, equivalent transformations and modifications made without departing from the spirit and scope of the present invention should be covered within the scope of the present invention.
Claims
1. An automated Chinese image-text pair data generation method based on LVLM, characterized in that, it is applicable to the case of only containing images, and specifically includes the following steps: Step S1, obtain image D1 and generate instruction prompt-1; Step S2, input D1 and prompt-1 into the LVLM model to form text T1; Step S3, perform truncated sample filtering on T1 to form text T2; Step S4, perform duplicate filtering on T2 to form text T3; Step S5, calculate the similarity S-1 between D1 and T3 through the Chinese CLIP model. If S-1 is less than the threshold γ, then delete D1, otherwise, retain D1.
2. An automated Chinese image-text pair data generation method based on LVLM according to claim 1, characterized in that, in step S3, performing truncated sample filtering on T1 to form T2 specifically includes the following steps: Step S301, determine the character length L of T1 T1 With the size of the character threshold max_new_tokens, if L T1 If it is less than max_new_tokens, T2 is set to T1 and step S4 is executed. Otherwise, the characters in T1 exceeding max_new_tokens are truncated to form T1-truncate. Step S302, determine whether the last character character-1 of T1-truncate is a Chinese full stop. If character-1 is a Chinese full stop, then set T2 as T1-truncate. Otherwise, delete the content after the last Chinese full stop in T1-truncate to form T2.
3. An automated Chinese image-text pair data generation method based on LVLM according to claim 1, characterized in that, in step S4, performing duplicate filtering on T2 to form T3 specifically includes the following steps: Step S401, divide T2 into L sentences to form text T3; Step S402, perform deduplication processing on T3 to obtain L' deduplicated sentences; Step S403, if L'<L, then delete D1, otherwise, execute step S5; wherein, in step S402, the deduplication processing is implemented by performing set operations on the L sentences.
4. An automated Chinese image-text pair data generation method based on LVLM, characterized in that, it is applicable to the case of containing an image and an English description of the image, and specifically includes the following steps: Step A1, obtain image D2 and the English description D2-description of D2; Step A2, calculate the similarity S-2 between D2 and D2-description through the Chinese CLIP model. If S-2 is less than the threshold γ, then delete D2, otherwise, retain D2; Step A3, generate instruction prompt-2 and input prompt-2 and D2-description into the LVLM model, and translate D2-description into Chinese to form text T4; Step A4, perform truncated sample filtering on T4 to form text T5; Step A5, perform duplicate filtering on T5 to form text T6.
5. An automated Chinese image-text pair data generation method based on LVLM according to claim 4, characterized in that, in step A4, performing truncated sample filtering on T4 to form text T5 specifically includes the following steps: Step A401: Determine the character length L of T4 T4 With the size of the character threshold max_new_tokens, if L T4 If it is less than max_new_tokens, T5 is set to T4 and step A5 is executed. Otherwise, the characters in T4 exceeding max_new_tokens are truncated to form T4-truncate. Step A402: Determine whether the last character character-2 of T4-truncate is a Chinese full stop. If character-2 is a Chinese full stop, set T5 to T4-truncate; otherwise, delete the content after the last Chinese full stop in T4-truncate to form T5.
6. A method for automatically generating Chinese image-text pairs based on LVLM according to claim 5, characterized in that, in step A5, perform duplicate filtering on T5 to form text T6. The data processing method described in step A5 specifically includes the following steps: Step A501: Divide T5 into N sentences to form text T6; Step A502: Perform duplicate removal processing on T6 to obtain N' sentences after duplicate removal processing; Step A503: If N'<N, delete D2; otherwise, output text T6; wherein, in step A502, the duplicate removal processing is implemented by performing set operations on N sentences.
7. An apparatus for automatically generating Chinese image-text pairs based on LVLM, characterized in that, suitable for the case of only containing images, and specifically includes the following modules: The first initialization module is used to obtain image D1 and generate instruction prompt-1; The first text generation module is connected to the first initialization module and is used to input D1 and prompt-1 into the LVLM model to form text T1; The first truncated sample filtering module is connected to the first text generation module and is used to perform truncated sample filtering on T1 to form text T2; The first duplicate filtering module is connected to the first truncated sample filtering module and is used to perform duplicate filtering on T2 to form text T3; The first sample processing module is connected to the first duplicate filtering module and is used to calculate the similarity S-1 between D1 and T3 through the Chinese CLIP model. If S-1 is less than the threshold γ, delete D1; otherwise, retain D1; wherein, the first truncated sample filtering module specifically includes the following sub-modules: The first truncation submodule is used to determine the character length L of T1 T1 With the size of the character threshold max_new_tokens, if L T1 If it is less than max_new_tokens, T2 is set to T1 and the first repetitive filtering module is executed. Otherwise, the characters in T1 exceeding max_new_tokens are truncated to form T1-truncate. The second truncation sub-module is connected to the first truncation sub-module and is used to determine whether the last character character-1 of T1-truncate is a Chinese full stop. If character-1 is a Chinese full stop, set T2 to T1-truncate; otherwise, delete the content after the last Chinese full stop in T1-truncate to form T2; The first duplicate filtering module specifically includes the following sub-modules: The first repetition sub-module is used to divide T2 into L sentences to form text T3; The second repetition sub-module is connected to the first repetition sub-module and is used to perform duplicate removal processing on T3 to obtain L' sentences after duplicate removal processing; The third repetition sub-module is connected to the second repetition sub-module and is used to delete D1 when L'<L; otherwise, execute the first sample processing module.
8. An apparatus for automatically generating Chinese image-text pairs based on LVLM, characterized in that, suitable for the case of containing an image and an English description of the image, and specifically includes the following modules: The second initialization module is used to obtain image D2 and its English description D2-description; The second sample processing module is connected to the second initialization module and is used to calculate the similarity S-2 between D2 and D2-description through the Chinese CLIP model. If S-2 is less than the threshold γ, then D2 is deleted; otherwise, D2 is retained; The second text generation module is connected to the second sample processing module and is used to generate instruction prompt-2 and input prompt-2 and D2-description into the LVLM model to translate D2-description into Chinese to form text T4; The second truncated sample filtering module is connected to the second text generation module and is used to perform truncated sample filtering on T4 to form text T5; The second duplicate filtering module is connected to the second truncated sample filtering module and is used to perform duplicate filtering on T5 to form text T6; where The second truncated sample filtering module specifically includes the following sub-modules: The third truncation submodule is used to determine the character length L of T4 T4 With the size of the character threshold max_new_tokens, if L T4 If it is less than max_new_tokens, T5 is set to T4 and the second repetitive filtering module is executed. Otherwise, the characters in T4 exceeding max_new_tokens are truncated to form T4-truncate. The fourth truncation sub-module is connected to the third truncation sub-module and is used to determine whether the last character character-2 of T4-truncate is a Chinese full stop. If character-2 is a Chinese full stop, then T5 is set to T4-truncate; otherwise, the content after the last Chinese full stop in T4-truncate is deleted to form T5; The second duplicate filtering module specifically includes the following sub-modules: The fourth duplicate sub-module is used to divide T5 into N sentences to form text T6; The fifth duplicate sub-module is connected to the fourth duplicate sub-module and is used to perform deduplication processing on T6 to obtain N' deduplicated sentences; The sixth duplicate sub-module is connected to the fifth duplicate sub-module and is used to delete D2 when N'<N; otherwise, text T6 is output.
9. A computer-readable storage medium, characterized in that, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method described in any one of claims 1-6 are implemented.
10. An electronic device, characterized in that, it includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the method described in any one of claims 1-6 are implemented.
Citation Information
Patent Citations
Method and device for constructing multi-modal knowledge based on large model, storage medium and electronic equipment
CN118051600A
Image processing method, device and equipment and readable storage medium
CN118397643A
Zero-shot prompt ensembling for zero-shot classification with text-image models
EP4407567A1
Method and apparatus for training visual language pre-training model, and device and medium
WO2023082915A1
