Universal construction method for field large-scale image-text pair data set based on multi-modal model

By screening and generating high-quality image-text data sets, the problem of insufficient data in vertical fields is solved, the training data of multi-modal models is expanded, and the adaptability and performance of the models in specific fields are improved.

CN118657975APending Publication Date: 2024-09-17ZHEJIANG UNIV +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410561499.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-08
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

In vertical fields such as remote sensing and medicine, there is a lack of high-quality large-scale image-text data, resulting in poor performance of pre-trained multi-modal visual language models on downstream tasks, and insufficient image and text data in specific domain datasets. , unable to complete effective fine-tuning of the model.

Method used

By collecting public data, using domain keyword filtering and deduplication, combining pre-trained visual language models and detectors for data screening, generating text annotations, and verifying text quality through generative models, we build image-text pair data that conforms to specific fields. collection, expanding data scale and quality.

Benefits of technology

It provides high-quality large-scale image and text pair data sets for multi-modal large models, supports their training and implementation in vertical fields, and improves the adaptability and performance of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118657975A
    Figure CN118657975A
Patent Text Reader

Abstract

The invention discloses a universal construction method for a domain large-scale image-text pair data set based on a multi-modal model. The method comprises the steps of original data selection, data extraction based on domain keywords, data integration and screening, text generation based on a domain-specific multi-modal large model, special filtering based on domain features and the like. According to the method, data with different original formats, different organization forms and different contents are reorganized by utilizing various public data in a scene of a multi-modal large model in different fields, text labeling in a specific field is performed on image data lacking text description by utilizing the multi-modal model, and then the data are checked and screened, so that the image data are subjected to text labeling in the specific field. Therefore, a new data set meeting specific requirements is constructed, and data support is provided for multi-modal model training and landing of all fields at present.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of dataset construction, and in particular relates to a general method for constructing a large-scale image-text pair dataset based on a multimodal model. Background Art

[0002] The rapid development of deep learning models has made significant progress in the fields of CV and NLP. Researchers have begun to explore the ability to combine vision and text to develop more powerful and general models that can understand multimodal content. With the development of multimodal technology, more and more people are trying to introduce multimodal tasks into certain vertical fields, such as medicine, remote sensing, law, finance and other fields.

[0003] Pre-trained world language models (VLMs) are a promising approach that can use the annotation information of natural language and the rich visual information in images to train or fine-tune general visual language base models. For example, models such as ALBERT, VilT, ALBEF, Oscar, Coca, and CLIP. The CLIP model is a typical example. It uses contrastive learning to combine the two modalities of image and text, and has achieved unprecedented achievements in many downstream tasks and vertical fields. It has very strong generalization capabilities. Another important application area of ​​VLM is generative models, such as DALLE and Diffusion models that can generate high-quality images. However, in many vertical fields such as remote sensing and medical fields, the training data involves changes in different image morphology and features, and there are differences between the training data between fields, resulting in VLMs pre-trained on natural images often performing poorly in vertical fields.

[0004] In order to better use the general pre-trained multimodal model in different fields, it is very necessary to use the generalization ability of the pre-trained multimodal model to adapt the model to the target domain so as to better migrate to the target scene. One idea is to inject the knowledge of the target domain into the model by pre-training on the data of the target domain, and obtain the downstream task model of the specific field. For example, in the FETA work, to obtain a downstream task model in a specific field, it is sufficient to directly use the general pre-trained basic model to perform LoRA fine-tuning on the image and text retrieval task.

[0005] Although deep learning and general pre-trained models have made significant achievements in many fields, fine-tuning models in specific fields requires a large amount of multimodal data. However, generally speaking, the image and text data contained in a single image-text pair dataset for a specific task or vertical field is too small to complete the fine-tuning task of the large visual language model on downstream tasks; and the unimodal image dataset containing more image data has a sufficient number of images, but often only has category labels and does not provide high-quality text annotations. For example, in the field of remote sensing, although considerable progress has been made in scene classification and object segmentation, further improving model performance is often limited by data size, because manual labeling is very labor-intensive and resource-intensive. Image parsing in the remote sensing field is highly dependent on the data size of the image and the quality of the labels.

[0006] In summary, many fields lack high-quality, large-scale image-text data. Summary of the invention

[0007] In view of the shortcomings of the prior art, the purpose of the present invention is to provide a general method for constructing a large-scale image-text dataset based on a multimodal visual language model. The present invention utilizes various public data to reorganize data of different original formats, different organizational forms, and different contents in the scenarios of multimodal large models in different fields. For image data lacking text description, a multimodal model is used to perform text annotation in a specific field, and then the data is checked and screened to construct a new dataset that meets specific requirements, thereby providing data support for the training and implementation of multimodal large models in various fields.

[0008] To achieve the above object, the present invention provides the following technical solution: a general method for constructing a large-scale image-text pair dataset based on a multimodal model, comprising the following steps:

[0009] Step 1: Collect existing public image-text pair data sets and use domain keywords to filter the image-text pair data in specific fields to extract specific image-text pairs;

[0010] Step 2: Use URL and other tools to further remove duplicate images extracted in step 1 to ensure the diversity of the data set;

[0011] Step 3: For the image-text pair data processed in step 2, use the pre-trained visual language model and the SOTA detector in the field to detect the image-text pairs, and further remove the data in non-target fields;

[0012] Step 4: Collect existing pure image datasets (without corresponding text annotations) in the field of the dataset to be constructed;

[0013] Step 5: Use the existing image-to-text generative model to annotate the existing pure image dataset collected in step 4. At the same time, for images with existing annotations or other related information, organize this information into corresponding texts in different forms according to templates.

[0014] Step 6: Using the existing generative model for generating images from text, reversely verify and screen the text generated in the above step 5 to ensure the quality of the generated text; sample and test the generated image-text pairs and score them, and verify the quality of the generated text based on statistical data;

[0015] Step 7: Merge the target domain data of the two source domains in the above step to obtain a scaled-up specific domain image-text pair dataset;

[0016] Step eight, after obtaining the data set, replace the text according to the descriptiveness of the text and the correlation between the image and the text. When two images are very similar and the text of one image is less descriptive, replace the text of the other image with a more descriptive text to update the data set.

[0017] As a further improvement of the present invention, the specific steps of deduplicating the image in step 2 are as follows: step 21, after downloading the image using the URL, remove the damaged data;

[0018] Step 22: Use the fastdup tool to detect abnormal and outlier data and remove similar and duplicate images to deduplicate and denoise the data.

[0019] As a further improvement of the present invention, the specific steps of step 3 using the pre-trained visual language model and the SOTA detector in the field to detect the image-text pair are as follows:

[0020] Step 31: Prepare template text for the target domain, select the CLIP-ConvNext-XXL model based on the CNN structure as the visual language model, and calculate each image x through the CLIP-ConvNext-XXL model. i The cosine similarity of i ;

[0021] Step 3.2: Use natural images as negative samples and target domain images as positive samples to construct a data set, then build a classifier to classify the data set and distinguish the types of images. i , classified as category c i The probability is c i =P(c i |x i ), where the classifier model should select the SOTA model in the target domain;

[0022] Step 33: Substitute the similarity scores s calculated in step 31 and step 32 i and the classifier score c i , use the threshold method to decide whether to select the current image as the target domain image, select c i Threshold top 80% and s i The images before the threshold 90% are taken as the target domain images.

[0023] As a further improvement of the present invention, in step 31, each image x is calculated i The specific method of cosine similarity is as follows: for the N prompts in the prepared template file, record them as t i , then use CLIP Text Encoder to extract text features and use the mean as the overall feature vector: The image feature vector is directly extracted through CLIPImageEncoder image (x i ), Then we get the similarity score s between each image and the target domain i .

[0024] As a further improvement of the present invention, the specific steps of using the existing image-to-text generative model in step 5 to perform text annotation on the existing image dataset collected in step 4 are as follows:

[0025] In step 51, the pre-trained image to text model BLIP2 is first selected, and the kernel method is selected as the sampling method; in step 52, the data is fine-tuned to adapt to the data of the target domain using the existing images and texts in the target domain, and the LORA method is selected as the fine-tuning method to quickly adapt to the target domain through efficient fine-tuning with a small number of parameters;

[0026] In step 53, 20 text descriptions are generated for each image, and then the top 10 are sorted using CLIPViT-H / 14 scores to get the top 10. The top 10 are further sorted using CLIP Resnet50×64 to get the top 5, and finally the text description is obtained.

[0027] As a further improvement of the present invention, the specific method for reverse verification and screening of the text generated in step six is: using the text to image generative model Stable Diffusion as the base model, sampling a part of the data in the dataset with generated text as the fine-tuning dataset, using the Dreambooth method to fine-tune the model, comparing the images generated by the same prompt before and after fine-tuning, and verifying whether the constructed dataset is closer to the target domain dataset.

[0028] Beneficial effects of the present invention:

[0029] The method of the present invention is a complete framework for producing large-scale image-text data sets, which includes the selection of data sources → screening and deduplication of data → text generation for images without text descriptions → verification of generated text → data combination. Data sets can be generated according to different target domains, providing data support for large-scale data training in the target domain.

[0030] The present invention proposes a complete large-scale image-text pair dataset production framework. When performing preliminary data collection, the present invention adopts a method that combines the existing single-modal image dataset and the image-text pair dataset; for the screening and deduplication of image-text pair data, we adopt a two-stage screening and deduplication method of keyword screening and Fastdup clustering method, so that the dataset is closer to the target domain and more streamlined, and a preliminary simple screening is achieved; to further screen the data close to the target domain, we use deeper features, and use the CLIP model and the target domain image classifier to focus on screening the image; when adding text annotations to the single-modal images of the target domain, we use the generation capability of the multimodal large model, and fine-tune the target domain data to generate high-quality text annotations; the evaluation of the dataset adopts a combination of the text-generated graph model and expert manual evaluation, which can objectively evaluate the quality of the dataset. In general, the present invention can provide a large-scale image-text pair dataset production method for multiple vertical fields, thereby providing support for further research in vertical fields. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 The figure is a schematic flow chart of the steps of a general method for constructing a large-scale image-text pair dataset based on a multimodal visual language model of the present invention. DETAILED DESCRIPTION

[0032] The present invention will be further described below in detail with reference to the embodiments shown in the accompanying drawings.

[0033] Reference Figure 1 As shown, a general method for constructing a large-scale image-text pair dataset based on a multimodal visual language model in this embodiment includes the following steps:

[0034] (1) Collect existing public image-text pair data sets and use domain keywords to filter the image-text pair data in specific fields, and extract specific image-text pairs. When making remote sensing field data sets, the present invention uses public image-text pair data sets including: LAION2B-en, LAION400M, LAIONCOCO, COYO700M, CC3M, CC12M, YFCC15M, WIT, Redcaps, SBU and Visual Genome, which are all public image-text pair data sets in the field of natural images. Taking the remote sensing field as an example, we collected 3 million remote sensing image-text pair data, mainly aerial images, and also some satellite images.

[0035] In the field of remote sensing, academic keywords are generally common image names in this field, as well as various variant descriptions, synonym replacements, etc. Field-related academic keywords include:

[0036] {"remote sensing","earth observ","aerial image","satellite photo","space image","spaceborne photo","space surveillance"}

[0037] In the field of remote sensing, there are many common remote sensing satellites and remote sensing companies involved. The keywords of field-related applications or company names include:

[0038] {"Google Earth","Freesound","Sentinel-1","Sentinel-2","Gaofen","USGS"}

[0039] The present invention uses regular expressions to match keywords for screening, as follows.

[0040] (2) After downloading the image using the URL, remove the damaged data. Then use the fastdup tool to deduplicate and denoise the data. The fastdup tool can efficiently detect abnormal data and outlier data. This tool uses the nearest neighbor graph model to find the close relationship between images, identify repeated and nearly repeated images, and identify the scale of similarity clustering. Removing similar and repeated images can prevent the model from learning how to remember images instead of learning the features in the images. For the results after clustering using fastdup, this embodiment only retains one image per cluster.

[0041] (3) In order to use the deeper features of the image for screening, this step uses a pre-trained visual language model and image classifier to further screen the data. Since the text description of the original data may not be close to the target domain, and the text description in the original data set is usually more targeted at specific objects, it is difficult to reflect the common features of the target domain. Therefore, it is necessary to prepare template text for the target domain and use the pre-trained VLM to match the target text to screen the image. Taking the remote sensing field as an example, the constructed text template sample is as follows:

[0042] {"a remote sensing image","a low resolution remote sensing image","abad remote sensing image",a close-up remote sensing image}

[0043] In the selection of pre-trained VLM, this embodiment selects the CLIP model. (The CLIP model is introduced here) The CLIP model based on CNN and the CLIP model based on ViT will extract different types of features. Generally speaking, the CLIP model based on CNN structure is easier to extract local information, and the CLIP model based on Transformer structure is easier to extract global information. When screening image data, this embodiment uses two CLIP models with different architectures for processing.

[0044] Specifically, for each image x i In this embodiment, the CLIP-ConvNext-XXL model based on the CNN structure is selected to calculate the cosine similarity. For the N prompts in the above template, this embodiment is recorded as t i , first use CLIP TextEncoder to extract text features and use the mean as the overall feature vector: The image feature vector is directly extracted through CLIP Image Encoder image (x i ), In this way, we actually get the similarity score s between each image and the target domain i .

[0045] Then, we build classifiers for natural images and target domain images. First, we need to build a data set and select positive and negative samples. When building a data set, we use natural images as negative samples and target domain images as positive samples. When selecting a data set, we must follow the following requirements:

[0046] 1. The types of positive samples selected should cover as many image types as possible in the target domain, such as satellite images and aerial images in the remote sensing field.

[0047] 2. The number of images of different types in the positive samples should be as consistent as possible.

[0048] 3. The number of images of positive and negative samples should be the same.

[0049] Then build a classifier to classify the above dataset to distinguish the types of images. i , is classified as category c i The probability is c i =P(c i |x i ), the classifier model should select the SOTA model in the target domain. In the experiment of the present invention, a total of 10,000 images were selected as the data set for training the classifier, including 5,000 target domain images and 5,000 natural images in the non-target domain. The data set was divided according to the ratio of training set: validation set: test set of 7:1:2. The final model had an accuracy rate of 99.20% in the validation set of the classification task and an accuracy rate of 97.55% in the test set.

[0050] Finally, the score s calculated based on the pre-trained VLM above i and the classifier score c i , using the threshold method to determine whether to select the current image as the target domain image. In the method of this embodiment, c i Threshold top 80% and s i The images before the threshold of 90% are taken as the target domain images, and the processing of the collected existing public image-text data set is completed.

[0051] (4) Collect existing images or image-text pair datasets in the target domain. In the field of remote sensing, this embodiment collects existing image-text pair datasets: UCM Captions, Sydney Captions, RSICD, RSITMD, and RSSVGD, as well as three large image datasets: BigEarthNet, Functional Map of the World (FMoW), and MillionAID. These image datasets only have category annotations.

[0052] (5) Use the existing generative model for generating text from images to annotate the existing image dataset collected in step 4. At the same time, for images with existing annotations or other related information, organize this part of information into corresponding texts in different forms according to the template; first select the pre-trained image to text model BLIP2, and select the kernel method as the sampling method, so that richer text annotations can be generated. Since the pre-trained BLIP2 model does not contain or contains less knowledge of the target domain, there is a certain risk in directly using it to generate text. Therefore, this embodiment first uses the existing images and texts in the target domain to fine-tune the data to adapt to the data in the target domain. The fine-tuning method selects the LORA method, which quickly adapts to the target domain through efficient fine-tuning with a small number of parameters.

[0053] In the process of making remote sensing datasets, this example uses RSITMD, RSVG and RSICD datasets to fine-tune the BLIP2 opt6.7B model, and adopts the LoRA parameter efficient fine-tuning method. Finally, the METEOR indicator is used to measure the quality of text generation.

[0054] Table 1 shows the comparison of METEOR scores on the above three datasets before and after fine-tuning.

[0055] Table 1

[0056]

[0057] For each image, this embodiment generates 20 text descriptions. First, the CLIP ViT-H / 14 score is used to sort the top 10, and then the top 10 is further sorted using CLIP Resnet50×64 to obtain the top 5, which is the text description finally used in this embodiment.

[0058] For images that have been annotated or have other relevant information (such as category labels, image shooting dates, geographic information, camera parameters, etc.), this information is organized into corresponding texts in different forms according to templates.

[0059] (6) Regarding the quality of the text in the dataset, this embodiment uses the text to image model StableDiffusion as the base model, samples a portion of the data in the dataset with generated text as the fine-tuning dataset, uses the Dreambooth method to fine-tune the model, and compares the images generated by the same prompt before and after fine-tuning to verify whether the constructed dataset is closer to the target domain dataset.

[0060] This example uses the constructed remote sensing dataset to fine-tune Stable Diffusion. The method uses Dreambooth, sets the image resolution to 512, and trains for 50,000 steps with a batch size of 50. At the same time, the text encoder is trained. Based on the common indicator FID of the image generation model, this example generates images for 40,000 different text descriptions to compare the changes in model performance. The trained model improves the performance of the original Stable Diffusion by 28.32.

[0061] Afterwards, this embodiment samples a portion of data from the dataset and verifies the text generation results through expert evaluation. The reference indicators are as follows, each indicator includes 5 levels:

[0062] (1) Relevance / Detail: Whether the text accurately describes the main information and important details in the image.

[0063] (2) Fantasy: whether objects or details appear in the text that are not in the image.

[0064] (3) Fluency / conciseness: Whether the language of the text is fluent and coherent.

[0065] The scores range from 5 to 1, representing the degree of text description of the image: Excellent, Good, Average, Below, Poor.

[0066] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.

Claims

1. A general method for constructing large-scale image-text datasets based on multimodal models. Features: The steps include: Step 1: Collect existing public image-text pair data sets and use domain keywords to filter the image-text pair data in specific fields to extract specific image-text pairs; Step 2: Use URL and other tools to further remove duplicates and outliers from the image and text pairs extracted in step 1; Step 3: For the image-text pair data processed in step 2, use the pre-trained visual language model and the SOTA image detector in the field to detect the image-text pairs, and further remove the data in non-target fields; Step 4: Collect existing pure image datasets in the field of the dataset to be constructed; Step 5: Use the existing image-to-text generative model to generate descriptive text for the existing pure image dataset collected in step 4. At the same time, for images with existing annotations or other related information, organize this information into a variety of corresponding texts according to the template; Step 6: Using the existing generative model for generating images from text, reversely verify and screen the text generated in the above step 5 to ensure the quality of the generated text; sample and test the generated image-text pairs and score them, and verify the quality of the generated text based on statistical data; Step 7: Merge the target domain data of the two source domains in the above step to obtain a scaled-up specific domain image-text pair dataset; Step eight, after obtaining the data set, replace the text according to the descriptiveness of the text and the correlation between the image and the text. When two images are very similar and the text of one image is less descriptive, replace the text of the other image with a more descriptive text to update the data set.

2. According to claim 1, a general method for constructing a large-scale domain image-text pair dataset based on a multimodal model, Features: The specific steps of deduplicating the image in step 2 are as follows: Step 21: After downloading the image using the URL, remove the damaged data; Step 22: Use the fastdup tool to detect abnormal and outlier data and remove similar and duplicate images to deduplicate and denoise the data.

3. According to claim 2, the general construction method of a large-scale field image-text pair dataset based on a multimodal model, Features: The specific steps of step 3 using the pre-trained visual language model and the SOTA detector in the field to detect the image-text pair are as follows: Step 31: Prepare template text for the target domain, select the CLIP-ConvNext-XXL model based on the CNN structure as the visual language model, and calculate each image x through the CLIP-ConvNext-XXL model. i The cosine similarity of i ; Step 32: Use natural images as negative samples and target domain images as positive samples to construct a data set, then build a classifier to classify the data set, distinguish the types of images, and convert an image x i , classified as category c i The probability is c i =P(c i |x i ), where the classifier model should select the SOTA model in the target domain; Step 33: Substitute the similarity scores s calculated in step 31 and step 32 i and the classifier score c i , use the threshold method to decide whether to select the current image as the target domain image, select c i Threshold top 80% and s i The images before the threshold 90% are taken as the target domain images.

4. According to claim 3, the general construction method of a large-scale field image-text pair dataset based on a multimodal model, Features: In step 3, each image x is calculated i The specific method of cosine similarity is as follows: for the N prompts in the prepared template file, record them as t i , then use CLIP Text Encoder to extract text features and use the mean as the overall feature vector: The image feature vector is directly extracted through CLIP Image Encoder image (x i ), Then we get the similarity score s between each image and the target domain i .

5. According to claim 4, the general construction method of a large-scale domain image-text pair dataset based on a multimodal model, Features: The specific steps of using the existing generative model for generating text from images in the step 5 to perform text annotation on the existing image dataset collected in the step 4 are as follows: step 51, first select the pre-trained image to text model BLIP2, and select the kernel method as the sampling method; step 52, use the existing images and texts in the target domain to fine-tune the data to adapt to the data of the target domain, wherein the LORA method is selected as the fine-tuning method to quickly adapt to the target domain through efficient fine-tuning with a small number of parameters; step 53, generate 20 text descriptions for each image, and then use CLIPViT-H / 14 score sorting to obtain the top 10, and then use CLIP Resnet50×64 to further sort the top 10 to obtain the top 5, and finally obtain the text description.

6. The general construction method of a large-scale domain image-text pair dataset based on a multimodal model according to claim 5, Features: The specific method for reverse verification and screening of the text generated in step 6 is: using the text to image generative model Stable Diffusion as the base model, sampling a part of the data in the dataset with generated text as the fine-tuning dataset, using the Dreambooth method to fine-tune the model, and comparing the images generated by the same prompt before and after fine-tuning to verify whether the constructed dataset is closer to the target domain dataset.