Image searching method and device, storage medium and electronic equipment

The input data is converted into feature vectors through a large multi-modal model, and the image vector library is used to search for target images, which solves the problem of low search efficiency for target images in the image library and achieves efficient image search.

CN118568285APending Publication Date: 2024-08-30太保科技有限公司
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410705668.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

In an image library, when the number of stored images is large, the efficiency of finding target folders and searching for target images based on the directory hierarchy is very inefficient, resulting in a time-consuming and inefficient search process.

Method used

Through the trained multi-modal large model, the input data is converted into feature vectors, the feature vectors similar to the target feature vectors are searched from the image vector library, and the target image is found using the one-to-one correspondence between the image vector library and the image library.

Benefits of technology

A method of efficiently searching for target images in the image library is implemented, which improves search efficiency and avoids inefficiencies caused by the complexity of the directory structure and manual search in traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118568285A
    Figure CN118568285A
Patent Text Reader

Abstract

The invention discloses an image searching method and device, a storage medium and electronic equipment, and relates to the technical field of image processing. Comprising the steps of converting input data composed of a query text and / or a query image into a first feature vector through a trained multi-modal large model; searching a feature vector from an image vector library, wherein the similarity between the feature vector and the first feature vector meets a preset first similarity condition, and taking the feature vector as a second feature vector; and taking an image corresponding to the second feature vector in the image library as the target image corresponding to the input data. Therefore, the problem of searching the target image based on the input data is converted into the problem of finding the second vector corresponding to the target image through the first vector corresponding to the input data. The similarity between the vectors can be efficiently and conveniently calculated based on the prior art, so that the target image can be efficiently searched from the image library by adopting the scheme provided by the invention.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method, device, storage medium and electronic device for searching images. Background Art

[0002] An image library is a database used to store images. An image library is usually configured with multiple levels of directories. In traditional solutions, when searching for a target image from an image library, technicians first use the directory hierarchy to determine the target folder that can store the target image; after determining the target folder, they manually search for the target image from the target folder.

[0003] The inventor of the present application has found that when there are many images stored in the image library, the directory structure corresponding to the image library is very complex. At this time, it is very time-consuming to find the target folder based on the hierarchical structure of the directory; even if the target folder is found, manually searching for the target image from the target folder is also very inefficient. Therefore, a solution is needed to efficiently search for the target image from the image library. Summary of the invention

[0004] Based on the above problems, the present application provides a method for searching images, which is used to efficiently search for target images from an image library.

[0005] The first aspect of the present application provides a method for searching an image, comprising:

[0006] Converting input data into a first feature vector by using a trained multimodal large model; the input data includes a query text and / or a query image;

[0007] Searching for a feature vector whose similarity with the first feature vector satisfies a preset first similarity condition from an image vector library as a second feature vector; the image vector library is generated based on the trained multimodal large model and the image library; the vectors in the vector library correspond one-to-one to the images in the image library;

[0008] The image corresponding to the second feature vector in the image library is used as the target image corresponding to the input data.

[0009] In an optional implementation, the step of training the multimodal large model includes:

[0010] Acquire a plurality of sample triplet data; the sample triplet data includes a sample image pair and a sample query text; the sample image pair includes a sample query image and a sample target image; the similarity between two images in the sample image pair satisfies a preset second similarity condition; the preset second similarity condition indicates that the image similarity is greater than or equal to a first similarity threshold or the metadata similarity is greater than or equal to a second similarity threshold; the sample query text includes text describing the features of each image in the sample image pair; the metadata similarity is used to describe the similarity between the metadata corresponding to each of the two images; the metadata is text data used to describe the image;

[0011] For each sample triple data in the plurality of sample triple data, converting a sample query image and / or a sample query text in the sample triple data into a first sample feature vector by using a first model to be trained; converting a sample target image in the sample triple data into a second sample feature vector by using a second model to be trained;

[0012] According to the difference between the similarity between the first sample feature vector and the second sample feature vector and a preset third similarity threshold, the network parameters of the first model to be trained and the network parameters of the second model to be trained are adjusted until the training is completed, and the trained first model to be trained is used as the multimodal large model.

[0013] In an optional implementation, the obtaining of a plurality of sample triplet data includes:

[0014] Based on the hierarchical structure of the directory of the sample database, the images stored in the sample database are divided into a plurality of image sets;

[0015] For each image set in the plurality of image sets, if the similarity between any two images in the image set satisfies the preset second similarity condition, determining that the two images constitute the sample image pair;

[0016] For each of the sample image pairs, constructing a sample query text corresponding to the sample image pair based on metadata corresponding to each of the two images in the sample image pair;

[0017] For each of the sample image pairs, the sample triplet data is generated based on the two images in the sample image pair and the sample query text corresponding to the sample image pair.

[0018] In an optional implementation, the images stored in the sample database are divided into a plurality of image sets based on the hierarchical structure of the directory of the sample database, including:

[0019] Determine the folder corresponding to the subdirectory at the bottom level of the directory as the target folder;

[0020] The images in the sample image library stored in the same target file are divided into the same set to obtain a plurality of image sets.

[0021] In an optional implementation, the step of obtaining the metadata similarity between two images in the sample image pair includes:

[0022] For each image in the sample image pair, generate metadata of the image by using an open source multimodal large model;

[0023] Through an open source multimodal large model, based on the metadata corresponding to each of the two sample images in the sample image pair, the metadata similarity between the two images in the sample image pair is obtained.

[0024] In an optional implementation, for each of the sample image pairs, constructing a sample query text corresponding to the sample image pair based on metadata corresponding to each of the two images in the sample image pair includes:

[0025] Through the open source large language model, based on the metadata corresponding to each sample image pair, the sample query text corresponding to the sample image pair is generated.

[0026] In an optional implementation, the images stored in the same target file in the sample image library are divided into the same set to obtain multiple image sets, including:

[0027] Dividing the images in the sample image library stored in the same target file into the same set to obtain a plurality of original image sets;

[0028] For each of the original image sets, duplicate images and images with image quality lower than a preset image quality index in the original image set are filtered out to obtain the multiple image sets.

[0029] A second aspect of the present application provides a device for searching an image, comprising:

[0030] A first feature vector acquisition module, used to convert input data into a first feature vector through a trained multimodal large model; the input data includes a query text and / or a query image;

[0031] A second feature vector acquisition module is used to search for a feature vector whose similarity with the first feature vector satisfies a preset first similarity condition from an image vector library as a second feature vector; the image vector library is generated based on the trained multimodal large model and the image library; the vectors in the vector library correspond one-to-one to the images in the image library;

[0032] The target image acquisition module is used to use the image corresponding to the second feature vector in the image library as the target image corresponding to the input data.

[0033] A third aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method introduced in any implementation manner of the first aspect.

[0034] A fourth aspect of the present application provides an electronic device, including:

[0035] a memory having a computer program stored thereon;

[0036] A processor is used to execute the computer program in the memory to implement the steps of the method introduced in any implementation manner of the first aspect.

[0037] Compared with the prior art, this application has the following beneficial effects:

[0038] The method for searching images disclosed in the present application includes: converting input data consisting of query text and / or query image into a first feature vector through a trained multimodal large model; searching for a feature vector whose similarity with the first feature vector satisfies a preset first similarity condition from an image vector library as a second feature vector; and using an image corresponding to the second feature vector in the image library as the target image corresponding to the input data. The image vector library is generated based on the trained multimodal large model; and the vectors in the image vector library correspond one-to-one to the images in the image library.

[0039] In this way, the present application converts the problem of searching for a target image based on input data into the problem of finding a second vector corresponding to the target image through a first vector corresponding to the input data. Since the similarity between vectors can be efficiently and conveniently calculated based on the prior art, the solution in the present application can efficiently search for the target image from the image library. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0041] Figure 1 A flowchart of a method for searching images provided in an embodiment of the present application;

[0042] Figure 2 A schematic diagram of a method for searching images provided in an embodiment of the present application;

[0043] Figure 3 A flowchart of a method for obtaining triple data provided in an embodiment of the present application;

[0044] Figure 4 A schematic diagram of the structure of a model to be trained provided in an embodiment of the present application;

[0045] Figure 5 A schematic diagram of the structure of a device for searching images provided in an embodiment of the present application. DETAILED DESCRIPTION

[0046] An image library is a database used to store images. An image library is usually configured with multiple levels of directories. In traditional solutions, when searching for a target image from an image library, technicians first use the directory hierarchy to determine the target folder that can store the target image; after determining the target folder, they manually search for the target image from the target folder.

[0047] The inventor of the present application has found that when there are many images stored in the image library, the directory structure corresponding to the image library is very complex. At this time, it is very time-consuming to find the target folder based on the hierarchical structure of the directory; even if the target folder is found, manually searching for the target image from the target folder is also very inefficient. Therefore, a solution is needed to efficiently search for the target image from the image library.

[0048] The method for searching images disclosed in the present application includes: converting input data consisting of query text and / or query image into a first feature vector through a trained multimodal large model; searching for a feature vector whose similarity with the first feature vector satisfies a preset first similarity condition from an image vector library as a second feature vector; and using an image corresponding to the second feature vector in the image library as the target image corresponding to the input data. The image vector library is generated based on the trained multimodal large model; and the vectors in the image vector library correspond one-to-one to the images in the image library.

[0049] In this way, the present application converts the problem of searching for a target image based on input data into the problem of finding a second vector corresponding to the target image through a first vector corresponding to the input data. Since the similarity between vectors can be efficiently and conveniently calculated based on the prior art, the solution in the present application can efficiently search for the target image from the image library.

[0050] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0051] Image libraries can be divided into many types, such as face recognition image libraries, medical image libraries, geographic information image libraries, certificate image libraries, trademark and copyright image libraries, artwork image libraries, advertising material libraries, architectural design image libraries, tourist scenery image libraries, and educational image libraries.

[0052] Regardless of the type of image library, the method for searching images disclosed in the present application can be used to search for a target image from the image library.

[0053] For ease of understanding, the following takes the auto insurance image library as an example and describes in detail the method for searching images in this application in conjunction with the accompanying drawings.

[0054] Figure 1 A flowchart of a method for searching images provided in an embodiment of the present application. Figure 1 As shown, the method for searching images disclosed in the present application includes:

[0055] S101, convert the input data into the first feature vector through the trained multimodal large model.

[0056] In the present application, the input data includes query text and / or query image, that is, the input data can be query text, query image, or a combination of query text and query image.

[0057] A multimodal large model is a deep learning model that can process input data of multiple modalities and convert the input data into corresponding feature vectors.

[0058] The multimodal large model in this application is pre-trained. The specific training method of the multimodal large model will be described in detail in the subsequent embodiments of this application.

[0059] For the auto insurance image library, the query image can be an image that is visually similar or related to the target image. For example, if the target image to be queried is a whole vehicle image of series B corresponding to brand A, the user can provide a whole vehicle image of series C corresponding to brand A as the query image.

[0060] For the auto insurance image library, the query text may be "search for images that match the instruction description". For example, if the target image that the user wants to search for is a photo of a white brand D vehicle with a bumper falling off, the query text may be "please find photos of a white brand D vehicle with a bumper falling off".

[0061] Table 1 exemplarily shows various scenarios that may be involved in searching for a target image from a car insurance image library, various query images that may be used, and various query texts that may be used.

[0062] Those skilled in the art may select at least one of the query image and query text in Table 1 as input data according to actual needs.

[0063] Of course, those skilled in the art can select other images as query images and other texts as query texts according to actual needs.

[0064] Table 1

[0065]

[0066] After the input data is determined, the input data is input into the trained multimodal large model, the features in the input data are extracted through the multimodal large model, and the input data is converted into a first feature vector.

[0067] S102: Searching for a feature vector from an image vector library, the feature vector having similarity with the first feature vector satisfying a preset first similarity condition, as a second feature vector.

[0068] The image vector library is generated based on the trained multimodal large model and the image library. The multimodal large model in this application is a deep learning model that can extract features of an image and convert the image into a feature vector.

[0069] It is understandable that the images stored in the image library may include some images with resolutions lower than a preset resolution threshold (called low-quality images), or meaningless images, such as black screen images; these images are not target images. Based on this, after acquiring the image library, the images in the image library can be verified for validity, and the above low-quality images or meaningless images can be labeled as "invalid" and not processed subsequently. This processing method will improve the search efficiency of searching for target images from the image library.

[0070] For the auto insurance image library, low-quality images and meaningless images in the auto insurance image library are first labeled as "invalid", and the remaining images are used as valid images in the image library.

[0071] After obtaining the valid images in the image library, the valid images are input into the trained multimodal large model, and the features of each valid image are extracted through the multimodal large model to obtain the feature vector corresponding to each valid image.

[0072] The feature vectors corresponding to each valid image are put into a set to obtain an image vector library. The vectors in the image vector library correspond one-to-one to the valid images in the image library.

[0073] After obtaining the first feature vector corresponding to the input data, a feature vector whose similarity with the first feature vector satisfies a preset first similarity condition is searched from the image vector library as the second feature vector.

[0074] The first similarity condition preset in the present application can be to screen out feature vectors whose similarity with the first feature vector is greater than a preset similarity threshold; or it can be to screen out N feature vectors with the greatest similarity with the first feature vector; wherein N is an integer greater than or equal to 1.

[0075] After the preset first similarity condition is determined, at least one of the Euclidean distance or the cosine similarity can be used to calculate the similarity between the first feature vector and each vector in the image vector library; then, the feature vector whose relationship with the first feature vector satisfies the preset first similarity condition is selected from multiple similarity values ​​as the second feature vector.

[0076] For example, if there are 5 feature vectors in the image vector library, the Euclidean distance can be used to calculate the similarity between each of the 5 feature vectors and the first feature vector to obtain 5 similarity values. If the 5 similarity values ​​are 0.2, 0.5, 0.4, 0.8 and 0.9 respectively; the preset first similarity condition is to select the 2 feature vectors with the greatest similarity to the first feature vector, then the second feature vectors are: a feature vector with a similarity of 0.9 to the first feature vector, and a feature vector with a similarity of 0.8 to the first feature vector.

[0077] S103: Use the image in the image library corresponding to the second feature vector as the target image corresponding to the input data.

[0078] As described above, the vectors in the image vector library correspond one-to-one to the images (valid images) in the image library.

[0079] After the second eigenvector is determined, the image corresponding to the second eigenvector can be determined. In the present application, the image corresponding to the second eigenvector is used as the target image corresponding to the input data.

[0080] In this way, the present application converts the problem of searching for a target image based on input data into the problem of finding a second vector corresponding to the target image through a first vector corresponding to the input data. Since the similarity between vectors can be efficiently and conveniently calculated based on the prior art, the solution in the present application can efficiently search for the target image from the image library.

[0081] Figure 2 A schematic diagram of a method for searching images provided in an embodiment of the present application. Figure 2 As shown, firstly, the original image library (auto insurance image library) is processed by the multimodal model in this solution (also called the multimodal large model) to obtain the image vector library (image feature library) corresponding to the auto insurance image library. After determining the query image and / or query text (query instruction), the query image and / or query text are input into the multimodal model of this solution to obtain the first feature vector; the feature vector whose similarity with the first feature vector meets the preset first similarity condition is searched from the image feature library (this process is also called multimodal search) to obtain the second feature vector; the image corresponding to the second feature vector is used as the target image corresponding to the input data.

[0082] It should be noted that in this application, the search method for searching for a target image from an image library based on a query image is referred to as an image search method; the search method for searching for a target image from an image library based on a query text is referred to as a text search method; and the method for searching for a target image from an image library based on a query image and a query text is referred to as a multimodal search method.

[0083] As described above, the multimodal large model in this application is a pre-trained deep learning model that can convert images and / or texts into corresponding feature vectors. The image search method disclosed in this application is implemented based on the multimodal large model.

[0084] Taking the automobile insurance image library as an example, the training process of the multimodal large model in this application is described in detail in combination with the accompanying drawings.

[0085] In an optional implementation, the following steps may be used to train the deep learning model to obtain the multimodal large model in this application, including:

[0086] Step 1: Get multiple sample triplet data.

[0087] The sample triplet data includes a sample image pair and a sample query text.

[0088] The sample image pair includes a sample query image and a sample target image; the similarity between the two images in the sample image pair satisfies a preset second similarity condition.

[0089] The preset second similarity condition indicates that the image similarity is greater than or equal to the first similarity threshold or the metadata similarity is greater than or equal to the second similarity threshold.

[0090] The sample query text includes text describing the features of each image in the sample image pair.

[0091] The metadata similarity is used to describe the similarity between the metadata corresponding to two images; metadata is text data used to describe images.

[0092] Figure 3 A flowchart of a method for obtaining triple data provided in an embodiment of the present application. Figure 3 As shown, the method for obtaining triplet data disclosed in this application includes:

[0093] S301, based on the hierarchical structure of the directory of the sample database, divide the images stored in the sample database into multiple image sets.

[0094] For the auto insurance database, the sample database is part of the data from the auto insurance database.

[0095] The directory is mainly used to organize, classify and index images in the image library, making it easier for technicians in this field to search for target images from the sample database.

[0096] It is understandable that a directory can have a rich hierarchical structure, including a root node, an intermediate node, and a child node; each child node may have a further child node.

[0097] The root node is the highest level of the directory and represents the entire image library. For the auto insurance image library, the root node is the auto insurance image library itself.

[0098] The intermediate node is located between the root node and the child node, and is used to further subdivide the content of the image library. There may be multiple intermediate nodes, each of which represents a more specific classification. For the auto insurance image library, the intermediate node can be an accident scene node, a vehicle damage node, a personal injury node, and so on.

[0099] Subnodes are further subdivisions of intermediate nodes, usually representing more specific image classifications or lists. For the auto insurance image library, the intermediate node "accident scene" may contain subnodes such as "night accident", "highway accident", "intersection accident" or "parking lot accident"; the subnodes of the vehicle damage node may contain subnodes such as "front damage", "rear damage", "side damage" or "roof damage".

[0100] It is understandable that in some cases, there may be deeper subnodes under a subnode. For the subnode of front damage in the car insurance database, subnodes that can be further distinguished include: bumper damage, hood damage, headlight damage, front windshield damage, and other subnodes.

[0101] In the traditional scheme, each directory node corresponds to a folder, and the images in the image library can be classified according to the hierarchy of the directory. For example, all photos related to node A in the directory are stored in the folder corresponding to node A.

[0102] In an optional implementation, after determining the hierarchical structure of the directory of the sample data, the folder corresponding to the bottom-level subdirectory in the directory of the sample image library can be determined as the target folder; the images stored in the same target file in the sample image library are divided into the same set to obtain multiple image sets.

[0103] The advantage of doing this is that the images in the image library can be efficiently divided into multiple image sets without changing the structure of the image library as much as possible and with as little time and labor costs as possible.

[0104] For the auto insurance image library, the images located in the bottom-level subfolder of the directory of the auto insurance image library can be added into a set according to the manually established directory structure, and they are considered to be related images.

[0105] For example, the auto insurance image library is constructed by directory construction according to the case number. Under the case number, there are bottom-level subfolders such as "subject vehicle materials", "subject vehicle invoices", and "first scene photos". The images in the above subfolders are added to the same set, that is, the images in the subfolder "first scene photos" are added to a set to obtain multiple original image sets.

[0106] It is understandable that in the present application, multiple original image sets can be used as multiple image sets; duplicate images or images with image quality lower than a preset image quality index in each original image set can also be filtered out to obtain multiple image sets. The image quality index can be image clarity. The meaning of the image quality index is not limited in the present application.

[0107] S302: For each image set in the multiple image sets, if the similarity between any two images in the image set satisfies the preset second similarity condition, determine that the two images constitute the sample image pair.

[0108] As described above, the preset second similarity condition indicates that the image similarity is greater than or equal to the first similarity threshold or the metadata similarity is greater than or equal to the second similarity threshold. In this application, the specific values of the first similarity threshold and the second similarity threshold are not limited, and they can be the same or different.

[0109] As described above, metadata is text data used to describe an image. After obtaining the sample image library, each sample image in the sample image library can be input into an open-source multimodal large model to generate corresponding metadata for each sample image.

[0110] Among them, the open-source multimodal large model includes but is not limited to CLIP (Contrastive Language-Image Pre-training), ViLBERT (Vision and Language BERT), or UNITER (Universal Image-Text Representation), etc.

[0111] When the sample image library is a sample auto insurance image library, the metadata may include an image scene label, an image entity label, and an image description.

[0112] Among them, the image scene label is used to summarize the scene of the entire picture; the image entity label is used to identify the objects existing in the image; the image description is to describe the image content in natural language.

[0113] For example, in the auto insurance scenario, the metadata that may be output for an image from the "First Scene Photo" folder may be: Scene: "First Scene of the Car Accident"; Entity Labels: {Entity Type: "Sedan", Color: "Black", Model: "BMW X3", License Plate Number: "沪C17AE3", Damage Location: "Front Bumper"}, {Entity Type: "Truck", Color: "White", Model: "Wuling Hongguang S", License Plate Number: "沪E10PW3", Damage Location: "Headlight"}, {Entity Type: "Railings"}; Image Description: "This is a photo of a car accident scene involving a sedan and a van, both with a certain degree of damage".

[0114] After obtaining the metadata of each sample image, the similarity of the metadata of any two sample images in the same image set can be calculated through an open-source multimodal large model to obtain the metadata similarity between these two images.

[0115] For the sample image library, the image similarity of any two sample images in the same image set can be calculated through an open-source multimodal large model.

[0116] For multiple image sets corresponding to the sample image library, when the similarity between any two sample images in an image set satisfies a preset second similarity condition, that is, when the image similarity between the two sample images is greater than or equal to the first similarity threshold or the metadata similarity is greater than or equal to the second similarity threshold, the two sample images are regarded as a sample image pair.

[0117] It is understandable that there are two images in the sample image pair, one image is the sample query image, and the other image is the sample target image. This application does not limit which image is the sample query image and which image is the sample target image.

[0118] The purpose of this step is to filter out sample image pairs that are visually and textually unrelated in the same image set.

[0119] S303: For each of the sample image pairs, based on metadata corresponding to the two images in the sample image pair, construct a sample query text corresponding to the sample image pair.

[0120] After obtaining multiple sample image pairs, the open source large language model can generate sample query text corresponding to the sample image pairs based on the instruction template and metadata corresponding to the two sample images in each sample image pair. The specific form of the instruction template is not limited in this application.

[0121] Among them, the open source large language models include but are not limited to Tongyi Qianwen, Wenxin Yiyan, etc.

[0122] S304: For each of the sample image pairs, generate the sample triplet data based on the two images in the sample image pair and the sample query text corresponding to the sample image pair.

[0123] For example, in the car insurance image library, if an image pair is two perspectives of an accident scene, the triple data corresponding to the image pair may be: {"query image": a frontal perspective of a car accident scene, "sample query text": "a similar car accident scene from a side perspective", "target image": a side perspective of a car accident scene}.

[0124] Through the methods in S301-S304, multiple sample triplet data can be obtained.

[0125] Step 2: for each sample triple data in the plurality of sample triple data, convert the sample query image and / or the sample query text in the sample triple data into a first sample feature vector through the first model to be trained; convert the sample target image in the sample triple data into a second sample feature vector through the second model to be trained;

[0126] Figure 4 A schematic diagram of the structure of a model to be trained provided in an embodiment of the present application. Figure 4 The structures of the first model to be trained and the second model to be trained are shown in FIG. Figure 4 The difference between the first model to be trained and the second model to be trained is that the first model to be trained has an image encoder and a text encoder, while the second model to be trained has only an image encoder.

[0127] It should be noted that, for the first model to be trained, the image encoder is used to process the input image, and the text encoder is used to process the input text. For the first model to be trained, the image can be input into the image encoder at the same time, and the text can be input into the text encoder, and the first model to be trained extracts the features of the input image and the input text to generate a first feature vector; only the image can be input without the text, and the first model to be trained converts the input image into the corresponding first feature vector; only the text can be input without the image, and the first model to be trained converts the input text into the corresponding first feature vector.

[0128] In the third step, according to the difference between the similarity between the first sample feature vector and the second sample feature vector and a preset third similarity threshold, the network parameters of the first model to be trained and the network parameters of the second model to be trained are adjusted until the training is completed, and the trained first model to be trained is used as the multimodal large model.

[0129] It should be noted that since the model training process is a process that is relatively well known to those skilled in the art, this content will not be further elaborated in this application.

[0130] In summary, the method for searching images disclosed in the present application includes: converting input data consisting of query text and / or query image into a first feature vector through a trained multimodal large model; searching for a feature vector whose similarity with the first feature vector satisfies a preset first similarity condition from an image vector library as a second feature vector; and using the image corresponding to the second feature vector in the image library as the target image corresponding to the input data. The image vector library is generated based on the trained multimodal large model; and the vectors in the image vector library correspond one-to-one to the images in the image library.

[0131] In this way, the present application converts the problem of searching for a target image based on input data into the problem of finding a second vector corresponding to the target image through a first vector corresponding to the input data. Since the similarity between vectors can be efficiently and conveniently calculated based on the prior art, the solution in the present application can efficiently search for the target image from the image library.

[0132] Based on the method for searching images disclosed in the aforementioned embodiment, the present application also discloses a device for searching images. Figure 5 A schematic diagram of a device for searching images provided in an embodiment of the present application. Figure 5 As shown, the image searching device 500 disclosed in the present application includes:

[0133] A first feature vector acquisition module 501 is used to convert input data into a first feature vector through a trained multimodal large model; the input data includes a query text and / or a query image;

[0134] A second feature vector acquisition module 502 is used to search for a feature vector whose similarity with the first feature vector satisfies a preset first similarity condition from an image vector library as a second feature vector; the image vector library is generated based on the trained multimodal large model and the image library; the vectors in the vector library correspond one-to-one to the images in the image library;

[0135] The target image acquisition module 503 is used to use the image corresponding to the second feature vector in the image library as the target image corresponding to the input data.

[0136] In an optional implementation, the image searching device 500 further includes a multimodal large model training device, including:

[0137] A sample data acquisition module, used to acquire a plurality of sample triplet data; the sample triplet data includes a sample image pair and a sample query text; the sample image pair includes a sample query image and a sample target image; the similarity between two images in the sample image pair satisfies a preset second similarity condition; the preset second similarity condition indicates that the image similarity is greater than or equal to a first similarity threshold or the metadata similarity is greater than or equal to a second similarity threshold; the sample query text includes text describing the features of each image in the sample image pair; the metadata similarity is used to describe the similarity between the metadata corresponding to each of the two images; the metadata is text data used to describe the image;

[0138] The intermediate data processing module is used for converting, for each sample triple data in the plurality of sample triple data, a sample query image and / or a sample query text in the sample triple data into a first sample feature vector through a first model to be trained; and converting, through a second model to be trained, a sample target image in the sample triple data into a second sample feature vector;

[0139] The multimodal large model training module is used to adjust the network parameters of the first model to be trained and the network parameters of the second model to be trained according to the difference between the similarity between the first sample feature vector and the second sample feature vector and a preset third similarity threshold until the training is completed, and the trained first model to be trained is used as the multimodal large model.

[0140] In an optional implementation, the sample data acquisition module includes:

[0141] An image set generating unit, configured to divide the images stored in the sample database into a plurality of image sets based on the hierarchical structure of the directory of the sample database;

[0142] an image pair determination unit, configured to, for each image set in the plurality of image sets, determine that the two images constitute the sample image pair if the similarity between any two images in the image set satisfies the preset second similarity condition;

[0143] A sample query text generating unit, configured to construct, for each of the sample image pairs, a sample query text corresponding to the sample image pair based on metadata corresponding to each of the two images in the sample image pair;

[0144] The unit group data acquisition unit is used to generate the sample triplet data for each sample image pair based on two images in the sample image pair and the sample query text corresponding to the sample image pair.

[0145] In an optional implementation, the image set generating unit includes:

[0146] The target folder determination subunit is used to determine the folder corresponding to the subdirectory at the bottom layer of the directory as the target folder;

[0147] The image set determination subunit is used to divide the images in the sample image library stored in the same target file into the same set to obtain multiple image sets.

[0148] In an optional implementation, the multimodal large model training device further includes an original data similarity determination module, including:

[0149] A metadata acquisition unit, configured to generate metadata of each image in the sample image pair by using an open source multimodal macro model;

[0150] The metadata similarity determination unit is used to obtain the metadata similarity between the two images in the sample image pair based on the metadata corresponding to each of the two sample images in the sample image pair through an open source multimodal large model.

[0151] In an optional implementation, the sample query text generating unit includes:

[0152] The sample text generation subunit is used to generate a sample query text corresponding to the sample image pair based on the metadata corresponding to each of the sample image pairs through an open source large language model.

[0153] In an optional implementation manner, the image set determination subunit includes:

[0154] The original image set generating subunit is used to divide the images stored in the same target file in the sample image library into the same set to obtain a plurality of original image sets;

[0155] The image set generating subunit filters out duplicate images and images whose image quality is lower than a preset image quality index in each of the original image sets to obtain the multiple image sets.

[0156] Based on the method and device for searching images provided in the aforementioned embodiments, the present application also provides a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements some or all of the steps in the method for searching images mentioned above.

[0157] Based on the method and apparatus for searching images provided in the foregoing embodiments, the present application further provides an electronic device, including:

[0158] a memory having a computer program stored thereon;

[0159] The processor is used to execute the computer program in the memory to implement part or all of the steps in the method for searching images provided in the above-mentioned embodiment.

[0160] It should be noted that each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is merely schematic, in which the unit described as a separate component may or may not be physically separated, and the component prompted as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.

[0161] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for searching an image, characterized in that: The method comprises: Converting input data into a first feature vector by using a trained multimodal large model; the input data includes a query text and / or a query image; Searching for a feature vector whose similarity with the first feature vector satisfies a preset first similarity condition from an image vector library as a second feature vector; the image vector library is generated based on the trained multimodal large model and the image library; the vectors in the vector library correspond one-to-one to the images in the image library; The image corresponding to the second feature vector in the image library is used as the target image corresponding to the input data.

2. The method according to claim 1, characterized in that The training steps of the multimodal large model include: Acquire a plurality of sample triplet data; the sample triplet data includes a sample image pair and a sample query text; the sample image pair includes a sample query image and a sample target image; the similarity between two images in the sample image pair satisfies a preset second similarity condition; the preset second similarity condition indicates that the image similarity is greater than or equal to a first similarity threshold or the metadata similarity is greater than or equal to a second similarity threshold; the sample query text includes text describing the features of each image in the sample image pair; the metadata similarity is used to describe the similarity between the metadata corresponding to each of the two images; the metadata is text data used to describe the image; For each sample triple data in the plurality of sample triple data, converting a sample query image and / or a sample query text in the sample triple data into a first sample feature vector by using a first model to be trained; converting a sample target image in the sample triple data into a second sample feature vector by using a second model to be trained; According to the difference between the similarity between the first sample feature vector and the second sample feature vector and a preset third similarity threshold, the network parameters of the first model to be trained and the network parameters of the second model to be trained are adjusted until the training is completed, and the trained first model to be trained is used as the multimodal large model.

3. The method according to claim 2, characterized in that The obtaining of a plurality of sample triplet data comprises: Based on the hierarchical structure of the directory of the sample database, the images stored in the sample database are divided into a plurality of image sets; For each image set in the plurality of image sets, if the similarity between any two images in the image set satisfies the preset second similarity condition, determining that the two images constitute the sample image pair; For each of the sample image pairs, constructing a sample query text corresponding to the sample image pair based on metadata corresponding to each of the two images in the sample image pair; For each of the sample image pairs, the sample triplet data is generated based on the two images in the sample image pair and the sample query text corresponding to the sample image pair.

4. The method according to claim 3, characterized in that The hierarchical structure of the directory based on the sample database divides the images stored in the sample database into a plurality of image sets, including: Determine the folder corresponding to the subdirectory at the bottom level of the directory as the target folder; The images in the sample image library stored in the same target file are divided into the same set to obtain a plurality of image sets.

5. The method according to claim 2, characterized in that: The step of obtaining the metadata similarity between two images in the sample image pair comprises: For each image in the sample image pair, generate metadata of the image by using an open source multimodal large model; Through an open source multimodal large model, based on the metadata corresponding to each of the two sample images in the sample image pair, the metadata similarity between the two images in the sample image pair is obtained.

6. The method according to claim 3, characterized in that For each of the sample image pairs, constructing a sample query text corresponding to the sample image pair based on metadata corresponding to the two images in the sample image pair, includes: Through the open source large language model, based on the metadata corresponding to each sample image pair, the sample query text corresponding to the sample image pair is generated.

7. The method according to claim 4, characterized in that The step of dividing the images in the sample image library stored in the same target file into the same set to obtain multiple image sets includes: Dividing the images in the sample image library stored in the same target file into the same set to obtain a plurality of original image sets; For each of the original image sets, duplicate images and images with image quality lower than a preset image quality index in the original image set are filtered out to obtain the multiple image sets.

8. A device for searching images, characterized in that: The device comprises: A first feature vector acquisition module, used to convert input data into a first feature vector through a trained multimodal large model; the input data includes a query text and / or a query image; A second feature vector acquisition module is used to search for a feature vector whose similarity with the first feature vector satisfies a preset first similarity condition from an image vector library as a second feature vector; the image vector library is generated based on the trained multimodal large model and the image library; the vectors in the vector library correspond one-to-one to the images in the image library; The target image acquisition module is used to use the image corresponding to the second feature vector in the image library as the target image corresponding to the input data.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method described in any one of claims 1 to 7 are implemented.

10. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Trademark batch retrieval method and system based on big data and AI assistance

    CN121412411A

  • Recommendation system and electrical drawing recommendation method

    WO2026223040A1