Image retrieval method and system based on multi-modal large model and electronic equipment

Extract target and background features in images through multi-modal large models and establish a feature vector base library, which solves the problems of multi-target extraction and background information neglect in the field of intelligent security, and achieves more efficient image retrieval and a wider retrieval range. .

CN118673176APending Publication Date: 2024-09-20CHONGQING ZHONGKE YUNCONG TECH CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410730466.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-06
Publication Date
2024-09-20

AI Technical Summary

Technical Problem

Existing technology In the field of intelligent security, image feature extraction requires multi-target feature extraction, which results in increased storage and retrieval complexity, and ignores background information, reducing retrieval accuracy.

Method used

Using an image retrieval method based on multi-modal large models, feature extraction is performed on images through pre-trained multi-modal large models, target features and background features are extracted, and a feature vector base library is established to support text, image, audio, and video information. multimodal retrieval.

Benefits of technology

It reduces the complexity of feature extraction and storage, improves retrieval accuracy, and supports a wider retrieval range and matching degree, including text search, audio search, and video search.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118673176A
    Figure CN118673176A
Patent Text Reader

Abstract

The invention relates to the field of artificial intelligence, particularly provides an image retrieval method and system based on a multi-modal large model and electronic equipment, and aims to solve or at least partially solve the problem of storage and retrieval complexity caused by the fact that multi-target feature extraction is needed and background information is ignored during image feature extraction. And the retrieval accuracy is reduced. According to the scheme, target and background feature extraction is carried out on an image through a multi-modal large model; and comparing the to-be-compared features with the image features in the feature vector base library, and outputting a comparison result. According to the scheme, extraction of multiple targets is avoided, the complexity of storage and retrieval is reduced, and the retrieval accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence, and specifically provides an image retrieval method, system and electronic equipment based on a multimodal large model. Background Art

[0002] In recent years, with the high informatization of all walks of life and the advent of the big data era, the rapid development of video surveillance software and hardware and capture recognition technology in the field of smart security has led to a daily increase in the number of camera captures by the order of billions, which has also brought challenges to the application of human and vehicle retrieval under big data. In the existing capture equipment, in order to efficiently extract information such as people and cars in the picture, it is necessary to deploy several sets of independent functional engines to extract the information of the captured pictures separately, such as: dedicated face recognition detection engine, vehicle recognition detection engine, etc. This has brought a great waste of deployment and operation and maintenance costs, and also brought great challenges to the similarity retrieval of human and vehicle pictures. How to make full use of the visual big model and solve the above-mentioned operation and maintenance and retrieval problems, so a multimodal feature retrieval system based on the visual understanding big model is proposed.

[0003] In the field of intelligent security, the existing image comparison system mainly detects people and cars in the picture and extracts features, and uses the distance of feature vectors to achieve similarity comparison and retrieval of pictures to obtain the top N pictures with the highest similarity. Since features need to be extracted for faces, bodies, cars, and non-cars respectively, multiple features may be extracted from a snapshot, and the features are independent of each other, resulting in large and redundant feature storage, which also increases the complexity and accuracy of the image retrieval system.

[0004] On the other hand, target detection and feature extraction are performed on snapshots. Different detection targets require different algorithms. For example, YOLOvX is used to detect vehicle targets in images, RetinaFace is used to detect face targets in images, dlib is used to obtain key points of faces in images, and ResNet is used to extract facial feature information. As there are more targets in snapshots and the image resolution is higher, detection and feature extraction take longer.

[0005] At the same time, the above detection and feature extraction only focus on the target information in the picture (face, body, car, non-car), but ignore the background information of the snapshot, such as trees, houses, roads, etc., which also has good reference value.

[0006] Accordingly, the art needs an image retrieval solution based on a multimodal large model to solve the above technical problems. Summary of the invention

[0007] In order to overcome the above-mentioned defects, the present invention is proposed to provide a solution or at least partially solve the technical problems such as the complexity of storage and retrieval, and reduced retrieval accuracy caused by the need for multi-target extraction of features during image feature extraction and ignoring background information.

[0008] In a first aspect, the present invention provides an image retrieval method based on a multimodal large model, comprising:

[0009] Extracting features from the image through a pre-trained multimodal large model, and establishing a feature vector base library based on the extracted image features; wherein the image features include target features in the image and background features in the image;

[0010] Obtaining, through the multimodal large model, the multimodal retrieval features to be compared corresponding to the multimodal retrieval information to be compared; wherein the multimodal retrieval information to be compared includes at least one of the following: text information, image information, audio information, and video information; the multimodal retrieval features to be compared include target features in the multimodal retrieval information to be compared and background features in the multimodal retrieval information to be compared;

[0011] Based on the multimodal retrieval features to be compared, a comparison is performed with the image features in the feature vector base library, and a comparison result is output.

[0012] In one embodiment, the target feature includes at least one of the following: human feature, animal feature, object feature; the background feature includes at least one of the following: tree, house, road, river, flower, sea.

[0013] In one embodiment, the type of the image feature includes at least one of the following: float type, int8 type; if the type of the image feature is float type, the feature dimension is 768.

[0014] In one embodiment, the comparison algorithm includes at least one of the following: Euclidean distance L2, inner product IP, and Hamming distance Hamming.

[0015] In one embodiment, features of an image are extracted using a pre-trained multimodal large model, the extracted image features are stored in a vector database, and a vector index is constructed to establish a feature vector base library.

[0016] In one embodiment, the vector indexing algorithm includes at least one of the following: FLAT, IVF_FLAT, IVF_PQ, HNSW, ANNOY.

[0017] In one embodiment, the pre-training method of the multimodal large model includes at least one of the following: mask reconstruction and contrastive learning.

[0018] In a second aspect, the present invention provides an image retrieval system based on a multimodal large model, comprising: a building module, an acquisition module, and a comparison module;

[0019] in,

[0020] The establishment module is used to extract features from the image through a pre-trained multimodal large model, and establish a feature vector base library based on the extracted image features; wherein the image features include target features in the image and background features in the image;

[0021] The acquisition module is used to acquire the multimodal retrieval features to be compared corresponding to the multimodal retrieval information to be compared through the multimodal macro model; wherein the multimodal retrieval information to be compared includes at least one of the following: text information, image information, audio information, and video information;

[0022] The comparison module is used to compare the image features in the feature vector base library based on the multimodal retrieval features to be compared, and output the comparison results.

[0023] In a third aspect, an electronic device is provided, comprising a processor and a memory, wherein the memory stores a program, and when the processor executes the program, the image retrieval method based on a multimodal large model as described in any one of the technical solutions of the above method is implemented.

[0024] In a fourth aspect, a readable storage medium is provided, storing a program, wherein when the program is executed, the image retrieval method based on a multimodal large model as described in any one of the technical solutions of the above method is implemented.

[0025] The above one or more technical solutions of the present invention have at least one or more of the following

[0026] Beneficial effects:

[0027] The technical solution of the present invention is: extracting features from an image through a pre-trained multimodal large model, and establishing a feature vector base library based on the extracted image features; wherein the image features include target features in the image and background features in the image;

[0028] Obtaining, through the multimodal large model, the multimodal retrieval features to be compared corresponding to the multimodal retrieval information to be compared; wherein the multimodal retrieval information to be compared includes at least one of the following: text information, image information, audio information, and video information; the multimodal retrieval features to be compared include target features in the multimodal retrieval information to be compared and background features in the multimodal retrieval information to be compared;

[0029] Based on the multimodal retrieval features to be compared, a comparison is performed with the image features in the feature vector base library, and a comparison result is output.

[0030] In the above scheme, the multimodal large model performs unified feature extraction on the image, avoiding the extraction of multiple targets. At the same time, when extracting image features, not only the target features in the image are extracted, but also the background features in the image are extracted, which reduces the complexity of storage and retrieval and improves the retrieval accuracy.

[0031] The above solution also supports text image search, audio image search, video image search, etc., with a wider search range and matching degree. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] The disclosure of the present invention will become more easily understood with reference to the accompanying drawings. It is easy for those skilled in the art to understand that these drawings are only for illustrative purposes and are not intended to limit the scope of protection of the present invention. In addition, similar numbers in the figures are used to represent similar components, among which:

[0033] Figure 1 It is a schematic flow chart of main steps of an image retrieval method based on a multimodal large model according to an embodiment of the present invention;

[0034] Figure 2 is a schematic flow chart of main steps of an image retrieval method based on a multimodal large model according to an embodiment of the present invention;

[0035] Figure 3 It is a schematic diagram of the main structural block diagram of an image retrieval system based on a multimodal large model according to an embodiment of the present invention. DETAILED DESCRIPTION

[0036] Some embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.

[0037] In the description of the present invention, "module" and "processor" may include hardware, software or a combination of the two. A module may include hardware circuits, various suitable sensors, communication ports, and memories, and may also include software parts, such as program codes, or a combination of software and hardware. The processor may be a central processing unit, a microprocessor, an image processor, a digital signal processor, or any other suitable processor. The processor has data and / or signal processing functions. The processor may be implemented in software, hardware, or a combination of the two. Non-temporary computer-readable storage media include any suitable medium that can store program codes, such as a magnetic disk, a hard disk, an optical disk, a flash memory, a read-only memory, a random access memory, and the like. The term "A and / or B" means all possible combinations of A and B, such as only A, only B, or A and B. The term "at least one A or B" or "at least one of A and B" has a similar meaning to "A and / or B", and may include only A, only B, or A and B. The singular terms "one" and "the" may also include plural forms.

[0038] The main innovative features of the present invention are:

[0039] A set of multimodal large models is designed to extract features from images. It can not only identify the target information in the image (for example, people), but also the background information in the image (for example, rivers, villages), and can also include more other information (such as expressions, clothing, etc.). The fusion features generated in this way retain more key information of the image, thereby avoiding the feature redundancy caused by extracting different types of features (face, body, car, non-car), which is more conducive to feature preservation and retrieval, and improves the accuracy of retrieval.

[0040] Advantages of the present invention:

[0041] Based on the image feature extraction of the multimodal large model, the extracted feature vector contains the target information in the image and also retains the background information in the image.

[0042] It solves the problem of the traditional snapshot detection and feature extraction process, which requires extracting features of faces, bodies, cars, non-cars and other targets in the image separately, as well as the complexity of subsequent storage and retrieval of multiple features.

[0043] Image feature extraction based on a multimodal large model can not only more accurately match the top N similarity images in the snapshot comparison and retrieval process, but also supports text search, audio search, video search, etc., with a wider retrieval range and matching degree.

[0044] See attached Figure 1 , Figure 1 FIG. 1 is a flow chart of the main steps of an image retrieval method based on a multimodal large model according to an embodiment of the present invention. Figure 1 As shown, it mainly includes the following steps S20-S50:

[0045] S20, image feature extraction

[0046] By adopting a multimodal large model to extract image features, the extracted image features include target features (such as people and vehicles) and richer background information (such as roads and rivers).

[0047] Among them, the type of image features includes at least one of the following: float type, int8 type; if the type of the image feature is float type, the feature dimension is 768, which retains the feature accuracy to a greater extent and improves the retrieval accuracy and ROC curve value.

[0048] S30, establishing a feature vector base based on the extracted image features

[0049] In this embodiment, features of the image are extracted through a pre-trained multimodal large model, the extracted image features are stored in a vector database, and a vector index is constructed to establish a feature vector base library.

[0050] The vector database includes at least one of the following: Faiss, Milvus.

[0051] S40, obtaining, through the multimodal large model, a multimodal retrieval feature to be compared corresponding to the multimodal retrieval information to be compared;

[0052] In this embodiment, the multimodal retrieval information to be compared includes at least one of the following: text information, image information, audio information, and video information; the multimodal retrieval features to be compared include target features in the multimodal retrieval information to be compared and background features in the multimodal retrieval information to be compared.

[0053] S50, based on the multimodal retrieval feature to be compared, compare it with the image features in the feature vector base library, and output the comparison result

[0054] In this embodiment, the comparison algorithm includes at least one of the following: Euclidean distance L2, inner product IP, and Hamming distance Hamming.

[0055] In this embodiment, the multimodal large model performs unified feature extraction on the image, avoiding the extraction of multiple targets. At the same time, when extracting image features, not only the target features in the image are extracted, but also the background features in the image are extracted, which reduces the complexity of storage and retrieval and improves the retrieval accuracy.

[0056] This embodiment also supports text image search, audio image search, video image search, etc., with a wider search range and matching degree.

[0057] Figure 2 is a schematic flow chart of main steps of an image retrieval method based on a multimodal large model according to an embodiment of the present invention;

[0058] S201, extracting features from the image using a pre-trained multimodal large model, and establishing a feature vector base library based on the extracted image features;

[0059] In this embodiment, the image features include target features in the image and background features in the image.

[0060] In this embodiment, the pre-training method of the multimodal large model includes at least one of the following: mask reconstruction and contrastive learning.

[0061] 1. The technical idea of ​​pre-training a multimodal large model based on "mask reconstruction" is as follows

[0062] In the pre-training stage, the "mask + reconstruction" self-supervised pre-training paradigm was adopted to train on a large-scale unlabeled video dataset. This paradigm uses an "asymmetric encoder-decoder" architecture to mask and reconstruct the input video, so as to train the encoder to extract the high-dimensional visual features of the video more efficiently. In this stage, there is no need for a labeled video training set, and only unlabeled video data in rich scenes can be collected for training, which greatly saves the video annotation cost and reduces the difficulty of obtaining training data.

[0063] Specifically:

[0064] For each input video, this architecture first divides it into image blocks of 16x16 pixels and converts each image block into a high-dimensional vector through a "block embedding" operation. Then, in the masking stage, 90% of the embedding vectors are randomly masked and the remaining 10% are used as the input of the encoder. The encoder is a standard Transformer self-attention mechanism model. The main task of this model is to learn the high-dimensional information of the original video as much as possible from the 10% input and extract the visual features of the video to provide rich contextual information for the subsequent reconstruction process.

[0065] The decoder is mainly responsible for the "reconstruction" process. It is also a Transformer model that receives the encoder's output as input and reconstructs the reconstruction target corresponding to the original video. In the previous self-supervised training paradigm of similar architectures, the reconstruction target is generally simply set to the original image that was masked in the mask stage.

[0066] 2. The technical idea of ​​pre-training a multimodal large model based on “contrastive learning” is as follows

[0067] Based on each image-text pair, image features and text features are obtained respectively;

[0068] Based on the image features and text features, by using a comparative learning method, the loss is calculated by using a loss function and based on the loss, the parameters of the multimodal pre-training model are continuously adjusted until a preset loss value is met, or the number of iterations reaches a preset number; wherein the multimodal large model is a transformer architecture;

[0069] The transformer architecture includes an image encoder and a text encoder; the image encoder is used to extract image features; the text encoder is used to extract text features.

[0070] Furthermore, for the image encoder, the architecture used includes at least one of the following: Vit-Base, Vit-Large, Vit-Giant, the input image is divided into image blocks, and the blocks are encoded into an embedding sequence to extract image features.

[0071] Of course, the transformer architecture may also include a language network, which includes but is not limited to language network models such as the BLOOM series and the LLAMA series.

[0072] The following is an explanation of the specific training process of the "multimodal large model":

[0073] Through web crawlers and existing data collection, cross-modal data pairs including massive images and texts are obtained and divided into training data sets and test data sets; an overall network model including image feature extraction and text feature extraction is constructed; after obtaining the image feature vector and text feature vector of the data sample pair, the InfoNCE loss function is calculated using different modal features, and then the Lamb optimizer is used to update the parameters of the overall network model to train the final multimodal large model.

[0074] The specific steps include:

[0075] S11, build a large-scale general image and text dataset

[0076] We obtained sample pairs of pictures and texts from a large number of Chinese and English websites in different fields and businesses; we crawled sample pairs of pictures and texts from social media; and we collected public sample pairs of pictures and texts. Through the above methods, we obtained more than 2 billion pairs of Chinese and English sample pairs.

[0077] S12, Model Architecture

[0078] The multimodal large model is based on the transformer architecture and includes at least an image encoder and a text encoder; the image encoder is used to extract image features; the text encoder is used to extract text features.

[0079] Among them, for the image encoder, the architecture adopted includes at least one of the following: Vit-Base, Vit-Large, Vit-Giant, the input picture is divided into image blocks, and the blocks are encoded into an embedded sequence for image feature extraction.

[0080] Of course, the multimodal large model can also include a language network, which is used to output task response information based on image features and task prompt information related to text characteristics; as for the language network, the language network includes but is not limited to BLOOM series, LLAMA series and other language network models.

[0081] S13, Metric Learning for Computing Loss

[0082] Metric learning is different from representation learning. It aims to learn the similarity between a pair of images and texts through the network. Usually, the pre-training of multimodal large models uses InfoNCE loss for metric learning.

[0083] The standard InfoNCE is shown in formula (1):

[0084]

[0085] In the above formula, B represents the number of multimodal image-text sample pairs in the nth batch of training data sets. is the feature used for retrieval (i.e. query), is the target matching feature (i.e. gallery), Represents the positive sample feature (in this method and is the feature of the same image-text sample pair), τ is the temperature coefficient, which is used to obtain the smooth output to obtain the soft label.

[0086] In the equation It is used to indicate the similarity between the same image and text sample data pairs. represents the sum of the similarities between a feature and all other sample features in the same batch (such as the similarity between the dog's picture feature and all text description features). Assume Then x / y can represent the proportion of the result of x to the whole. The optimization goal of the loss is to increase the value of x / y, that is, to increase the similarity x between the same image-text sample pairs and reduce the total similarity y between different image-text sample pairs.

[0087] It is to normalize the x / y results, which is more conducive to target optimization. The τ in is the smoothed output result, and the output distribution is more balanced.

[0088] The image-text contrast loss function minimizes the loss by narrowing the feature distance between the image and text pairs of the positive sample. The infoNCE loss of image-text contrast consists of two parts, as shown in Formula 2:

[0089]

[0090] Among them, L I→T is the infoNCE loss for text retrieval from images, L T→I is the infoNCE loss for retrieving images using text. Expand formula (1) and bring in the image text features, and the results are shown in formulas 3 and 4:

[0091]

[0092] Among them, Z I and Z T Represent image features and text features respectively.

[0093] Through loss calculation, the multimodal large model is pre-trained until the loss meets the requirements.

[0094] In this embodiment, the target feature includes at least one of the following: human feature, animal feature, object feature; the background feature includes at least one of the following: tree, house, road, river, flower, sea.

[0095] In this embodiment, the type of the image feature includes at least one of the following: float type, int8 type. If the type of the image feature is float type, the feature dimension is 768, which can retain the feature accuracy to a greater extent and improve the accuracy of retrieval and ROC curve value.

[0096] In this embodiment, the image features are extracted through a pre-trained multimodal large model, the extracted image features are stored in a vector database, and a vector index is constructed to establish a feature vector base library. Vector index refers to a more time and space efficient data structure constructed for vectors through a certain mathematical model.

[0097] Specifically: the extracted image features are stored in a vector database, and a vector index is constructed to facilitate subsequent feature comparison; the vector index algorithms include but are not limited to FLAT, IVF_FLAT, IVF_PQ, HNSW, and ANNOY.

[0098] S202, obtaining, through the multimodal large model, multimodal retrieval features to be compared corresponding to the multimodal retrieval information to be compared;

[0099] In this embodiment, the multimodal retrieval information to be compared includes at least one of the following: text information, image information, audio information, and video information; the multimodal retrieval features to be compared include target features in the multimodal retrieval information to be compared and background features in the multimodal retrieval information to be compared.

[0100] S203: Based on the multimodal retrieval feature to be compared, compare it with the image features in the feature vector base library, and output the comparison result.

[0101] In this embodiment, the comparison algorithm includes at least one of the following: Euclidean distance L2, inner product IP, and Hamming distance Hamming.

[0102] The principle of vector retrieval is based on the calculation of similarity between vectors. By calculating the similarity between the query vector and each vector stored in the index, the vector most similar to the query vector can be found, thus completing the retrieval operation. Among them, similarity calculation methods include cosine similarity, Euclidean distance, Manhattan distance, etc.

[0103] In this embodiment, the multimodal large model performs unified feature extraction on the image, avoiding the extraction of multiple targets. At the same time, when extracting image features, not only the target features in the image are extracted, but also the background features in the image are extracted, which reduces the complexity of storage and retrieval and improves the retrieval accuracy.

[0104] This embodiment also supports text image search, audio image search, video image search, etc., with a wider search range and matching degree.

[0105] Figure 3 is a schematic diagram of the main structural block diagram of an image retrieval system based on a multimodal large model according to an embodiment of the present invention. Figure 3 As shown, it includes a building module 301, an acquisition module 302, and a comparison module 303;

[0106] The establishment module 301 is used to extract features from an image through a pre-trained multimodal large model, and to establish a feature vector base library based on the extracted image features; wherein the image features include target features in the image and background features in the image;

[0107] The acquisition module 302 is used to acquire the multimodal retrieval features to be compared corresponding to the multimodal retrieval information to be compared through the multimodal macro model; wherein the multimodal retrieval information to be compared includes at least one of the following: text information, image information, audio information, and video information;

[0108] The comparison module 303 is used to compare the image features in the feature vector base library based on the multimodal retrieval features to be compared, and output the comparison results.

Claims

1. An image retrieval method based on a multimodal large model, characterized in that: include: Extracting features from the image through a pre-trained multimodal large model, and establishing a feature vector base library based on the extracted image features; wherein the image features include target features in the image and background features in the image; Obtaining, through the multimodal large model, the multimodal retrieval features to be compared corresponding to the multimodal retrieval information to be compared; wherein the multimodal retrieval information to be compared includes at least one of the following: text information, image information, audio information, and video information; the multimodal retrieval features to be compared include target features in the multimodal retrieval information to be compared and background features in the multimodal retrieval information to be compared; Based on the multimodal retrieval features to be compared, a comparison is performed with the image features in the feature vector base library, and a comparison result is output.

2. The method according to claim 1, characterized in that The target feature includes at least one of the following: human feature, animal feature, object feature; the background feature includes at least one of the following: tree, house, road, river, flower, sea.

3. The method according to claim 1, characterized in that The type of the image feature includes at least one of the following: float type and int8 type; if the type of the image feature is float type, the feature dimension is 768.

4. The method according to claim 1, characterized in that: The comparison algorithm includes at least one of the following: Euclidean distance L2, inner product IP, and Hamming distance Hamming.

5. The method according to claim 1, characterized in that The image features are extracted through a pre-trained multimodal large model, the extracted image features are stored in a vector database, and a vector index is constructed to establish a feature vector base library.

6. The method according to claim 5, characterized in that The vector indexing algorithm includes at least one of the following: FLAT, IVF_FLAT, IVF_PQ, HNSW, ANNOY.

7. The method according to claim 1, characterized in that The pre-training method of the multimodal large model includes at least one of the following: mask reconstruction and contrastive learning.

8. An image retrieval system based on a multimodal large model, characterized in that: include: Create modules, obtain modules, and compare modules; The establishment module is used to extract features from the image through a pre-trained multimodal large model, and establish a feature vector base library based on the extracted image features; wherein the image features include target features in the image and background features in the image; The acquisition module is used to acquire the multimodal retrieval features to be compared corresponding to the multimodal retrieval information to be compared through the multimodal macro model; wherein the multimodal retrieval information to be compared includes at least one of the following: text information, image information, audio information, and video information; The comparison module is used to compare the image features in the feature vector base library based on the multimodal retrieval features to be compared, and output the comparison results.

9. An electronic device comprising a processor and a memory, wherein the memory stores a program, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 7 is implemented.

10. A readable storage medium storing a program, characterized in that: When the program is executed, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Book retrieval method and device based on large model technology, equipment and medium

    CN119540587A

  • Image data storage and retrieval method and device based on lightweight multi-modal model

    CN119903201A

  • Image data storage and retrieval method and apparatus based on lightweight multi-modal model

    CN119903201B