Multi-modal lightweight dynamic knowledge enhancement method and device and storage medium
By constructing a multimodal knowledge base and performing cross-modal fusion, the problem of low efficiency of multimodal pre-training models in fine-grained data retrieval is solved, efficient specific information retrieval is achieved, and computing resource consumption is reduced. It is suitable for Lightweight deployment.
Patent Information
- Application Number
- CN202410548464.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-06
- Publication Date
- 2024-08-30
AI Technical Summary
Existing multi-modal pre-training models perform poorly when processing rare and fine-grained data, resulting in low retrieval efficiency, and improved methods require high training costs and computing resources, limiting the feasibility of lightweight and rapid deployment.
By constructing an image small sample knowledge base and a text small sample knowledge base, the representation to be fused and the cross-modal representation are determined based on single-modal search, and cross-modal fusion is performed to obtain a knowledge-enhanced fusion representation and improve the retrieval efficiency of specific information. .
It significantly improves the retrieval efficiency of specific information, reduces computing resource consumption and training costs, and is suitable for fast and lightweight multi-modal information processing scenarios.
Smart Images

Figure CN118568487A
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a multimodal lightweight dynamic knowledge enhancement method, device and storage medium. Background Art
[0002] With the rapid development of Internet and multimedia technology, the information that individuals are exposed to in modern society presents multimodal characteristics, especially images and texts. However, the diversity and richness of this information poses challenges to the accurate identification and retrieval of specific information.
[0003] The core of multimodal learning is to utilize the complementarity between different modalities and eliminate the redundant information between modalities, so as to learn richer and more accurate feature representations, and the quality of the retrieval effect is directly subject to the quality of these learned feature representations. At present, large-scale multimodal pre-training models such as the Contrastive Language-Image Pre-training (CLIP) model perform well in retrieval tasks of general concepts due to their strong generalization ability and understanding of a wide range of concepts. However, when dealing with certain data that are relatively rare in the training stage and have fine-grained features, the performance is often unsatisfactory. This is mainly because the specificity and complexity of this type of information requires the model to have more detailed discrimination capabilities and sensitivity to subtle differences.
[0004] Current methods for improving CLIP models in rare data retrieval mainly include expanding rare and fine-grained datasets and additional training of CLIP. However, although these methods are effective, they are accompanied by significant training costs and computing resource requirements, resulting in inefficient overall processes and not conducive to lightweight and fast deployment. In practical applications, their feasibility is limited due to their high costs and inefficient processes, especially in scenarios where fast and lightweight solutions are sought. Summary of the invention
[0005] The embodiments of the present application provide a multimodal lightweight dynamic knowledge enhancement method, device and storage medium to solve the technical problem of low efficiency of multimodal retrieval of images and texts in related technologies.
[0006] In a first aspect, an embodiment of the present application provides a multimodal lightweight dynamic knowledge enhancement method, comprising:
[0007] Based on the vector representation of the small sample set of images and the vector representation of the small sample set of text, a small sample knowledge base of images and a small sample knowledge base of text are constructed in the form of a multimodal visual codebook; based on a unimodal search method, a cross-modal representation corresponding to the representation to be fused is determined from the small sample knowledge base of images or the small sample knowledge base of text;
[0008] The representation to be fused and the cross-modal representation are fused to obtain a knowledge-enhanced fusion representation.
[0009] In some embodiments, the method further comprises:
[0010] Get vector representations of small sample sets of images and vector representations of small sample sets of text.
[0011] In some embodiments, the step of obtaining the vector representation of the small sample set of images and the vector representation of the small sample set of texts includes:
[0012] Get the preparatory training data set;
[0013] Acquire a small sample set of images and a small sample set of text based on the preliminary training data set;
[0014] Based on the contrastive language image pre-trained CLIP model, vector representations of the small sample set of images and vector representations of the small sample set of texts are obtained.
[0015] In some embodiments, the method further comprises:
[0016] When the preset timer expires, determining a second threshold based on the knowledge-enhanced fusion representation, where the second threshold is a threshold corresponding to the cross-modal representation;
[0017] When the second threshold and the first threshold meet a preset condition, the visual representation or text representation corresponding to the first threshold is replaced by the cross-modal representation.
[0018] In some embodiments, when the second threshold and the first threshold meet a preset condition, replacing the visual representation or text representation corresponding to the first threshold with the cross-modal representation includes:
[0019] When the second threshold is not less than the first threshold, the visual representation or text representation corresponding to the first threshold is replaced with the cross-modal representation.
[0020] In some embodiments, the code table of the image small sample knowledge base is a prototype representation of the normalized image vector representation corresponding to each category, and the visual words of the image small sample knowledge base are cross-modal text representations corresponding to the category.
[0021] In some embodiments, the fusing the representation to be fused and the cross-modal representation to obtain a knowledge-enhanced fused representation includes:
[0022] The representation to be fused and the cross-modal representation are input into a fusion module to obtain a knowledge-enhanced fusion representation output by the fusion module, wherein the fusion module is determined based on a contrastive learning loss function.
[0023] In a second aspect, the embodiment of the present application further provides a multi-modal lightweight dynamic knowledge enhancement device, including:
[0024] A first construction module is used to construct an image small sample knowledge base and a text small sample knowledge base in the form of a multimodal visual code book based on the vector representation of the image small sample set and the vector representation of the text small sample set;
[0025] A first determination module is used to determine the representation to be fused from the image small sample knowledge base or the text small sample knowledge base based on a unimodal search method, and determine the cross-modal representation corresponding to the representation to be fused;
[0026] The first fusion module is used to fuse the representation to be fused and the cross-modal representation to obtain a fused representation after knowledge enhancement.
[0027] In some embodiments, the multimodal lightweight dynamic knowledge enhancement device further includes:
[0028] The first acquisition module is used to acquire the vector representation of the image small sample set and the vector representation of the text small sample set.
[0029] In some embodiments, the first acquisition module includes:
[0030] A first acquisition submodule is used to acquire a preliminary training data set;
[0031] A second acquisition submodule is used to acquire a small sample set of images and a small sample set of text based on the preliminary training data set;
[0032] The third acquisition submodule is used to acquire the vector representation of the small sample set of images and the vector representation of the small sample set of text based on the comparative language image pre-trained CLIP model.
[0033] In some embodiments, the multimodal lightweight dynamic knowledge enhancement device further includes:
[0034] A second determination module, configured to determine a second threshold based on the knowledge-enhanced fusion representation when a preset timer expires, wherein the second threshold is a threshold corresponding to the cross-modal representation;
[0035] The first processing module is used to replace the visual representation or text representation corresponding to the first threshold with the cross-modal representation when the second threshold and the first threshold meet a preset condition.
[0036] In some embodiments, the first processing module includes:
[0037] The first processing submodule is configured to replace the visual representation or textual representation corresponding to the first threshold with the cross-modal representation when the second threshold is not less than the first threshold.
[0038] In some embodiments, the code table of the image small sample knowledge base is a prototype representation of the normalized image vector representation corresponding to each category, and the visual words of the image small sample knowledge base are cross-modal text representations corresponding to the category.
[0039] In some embodiments, the first fusion module includes:
[0040] The fourth acquisition submodule is used to input the representation to be fused and the cross-modal representation into a fusion module to obtain the knowledge-enhanced fusion representation output by the fusion module, and the fusion module is determined based on the contrastive learning loss function.
[0041] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, it implements any of the multimodal lightweight dynamic knowledge enhancement methods described above.
[0042] In a fourth aspect, an embodiment of the present application further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the multimodal lightweight dynamic knowledge enhancement methods described above.
[0043] In a fifth aspect, an embodiment of the present application further provides a computer program product, including a computer program, which, when executed by a processor, implements any of the multimodal lightweight dynamic knowledge enhancement methods described above.
[0044] The multimodal lightweight dynamic knowledge enhancement method, device and storage medium provided in the embodiments of the present application construct a small sample knowledge base of images and a small sample knowledge base of texts, and then determine the representation to be fused and the cross-modal representation corresponding to the representation to be fused according to the corresponding knowledge base, and finally perform cross-modal fusion to obtain a fused representation after knowledge enhancement. On the basis of the powerful representation learning of the existing large-scale pre-trained multimodal model, rare and fine-grained cross-modal representation information is integrated to improve the quality of the original representation and significantly improve the retrieval efficiency of specific information. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the following is a brief introduction to the drawings required for use in the embodiments or the related technical descriptions. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0046] Figure 1 It is a flowchart of a multimodal lightweight dynamic knowledge enhancement method provided in an embodiment of the present application;
[0047] Figure 2 is a schematic diagram of a small sample knowledge base provided in an embodiment of the present application;
[0048] Figure 3 It is a framework diagram of cross-modal representation pre-training provided in an embodiment of the present application;
[0049] Figure 4 This is a dynamic small sample knowledge base update flow chart provided in an embodiment of the present application;
[0050] Figure 5 It is a structural schematic diagram of a text answer multimodal lightweight dynamic knowledge enhancement device provided in an embodiment of the present application;
[0051] Figure 6 It is a schematic diagram of the physical structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, 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.
[0053] Figure 1 is a flow chart of a multi-modal lightweight dynamic knowledge enhancement method provided in an embodiment of the present application, such as Figure 1 As shown, the embodiment of the present application provides a multi-modal lightweight dynamic knowledge enhancement method, including:
[0054] Step 101 : constructing an image small sample knowledge base and a text small sample knowledge base in the form of a multimodal visual codebook based on the vector representation of the image small sample set and the vector representation of the text small sample set.
[0055] Specifically, in order to solve the above technical problems, this application introduces a small sample knowledge base of pictures and texts based on the original Chinese pre-trained CLIP model, enhances the knowledge of the original CLIP representation, and improves the retrieval rate of specific information. At the same time, during the reasoning process, according to the set update threshold, the information in the knowledge base is dynamically updated regularly.
[0056] First, we initialize the N-way k-shot specific information small sample image set, use the image description generation model to obtain its corresponding small sample text set, and use the Chinese pre-trained CLIP model to extract the image small sample set I K Characterization and text sample set L K Characterization Secondly, small sample knowledge bases of images and texts are constructed in the form of visual code books.
[0057] Step 102: Determine the cross-modal representation corresponding to the representation to be fused from the image small sample knowledge base or the text small sample knowledge base based on a unimodal search method.
[0058] Specifically, for each retrieval request, the CLIP model is used to obtain the representation of the retrieval request, that is, the representation to be fused, and the code table item most similar to the retrieval request representation is found from the knowledge base of the corresponding modality through a single-modal search, and then the cross-modal representation of the item is obtained.
[0059] Step 103: fuse the representation to be fused and the cross-modal representation to obtain a knowledge-enhanced fusion representation.
[0060] Specifically, a shallow Transformer representation fusion module is constructed, the representation to be fused and the cross-modal representation are input into the representation fusion module together, and the fused representation is output.
[0061] In the downstream task reasoning stage, the knowledge-enhanced representation is used for subsequent information retrieval, and the update threshold of the knowledge base is calculated at regular intervals to achieve dynamic updating of the knowledge base.
[0062] The multimodal lightweight dynamic knowledge enhancement method provided in the embodiment of the present application constructs a small sample knowledge base of images and a small sample knowledge base of texts, determines the representation to be fused and the cross-modal representation corresponding to the representation to be fused according to the corresponding knowledge base, and finally performs cross-modal fusion to obtain a fused representation after knowledge enhancement. On the basis of the powerful representation learning of the existing large-scale pre-trained multimodal model, rare and fine-grained cross-modal representation information is integrated to improve the quality of the original representation and significantly improve the retrieval efficiency of specific information.
[0063] In some embodiments, the method further comprises:
[0064] Get vector representations of small sample sets of images and vector representations of small sample sets of text.
[0065] Specifically, we can first use the N-Way K-shot method to select a small sample image set with specific information, and then use the image description generation model to obtain the corresponding small sample text set.
[0066] Among them, the acquisition of specific information sets can use specific information web page images as training data, and use crawler technology to crawl web page images of specified specific information categories. In some cases, no less than 200,000 specific information images of N categories can be crawled as preliminary training data sets.
[0067] Then, the Chinese pre-trained CLIP model is used to represent the vector representation of the small sample set of images and the small sample set of text respectively.
[0068] The multimodal lightweight dynamic knowledge enhancement method provided in the embodiment of the present application constructs a small sample knowledge base of images and a small sample knowledge base of texts, determines the cross-modal representation corresponding to the representation to be fused according to the corresponding knowledge base, and finally performs cross-modal fusion to obtain a fused representation after knowledge enhancement. On the basis of the powerful representation learning of the existing large-scale pre-trained multimodal model, rare and fine-grained cross-modal representation information is integrated to improve the quality of the original representation and significantly improve the retrieval efficiency of specific information.
[0069] In some embodiments, the step of obtaining the vector representation of the small sample set of images and the vector representation of the small sample set of texts includes:
[0070] Get the preparatory training data set;
[0071] Acquire a small sample set of images and a small sample set of text based on the preliminary training data set;
[0072] Based on the contrastive language image pre-trained CLIP model, vector representations of the small sample set of images and vector representations of the small sample set of texts are obtained.
[0073] Specifically, a small sample image set I is first selected from the preparatory training data set using the N-Way K-shot method. K , further, a multimodal image description generation model is used to obtain a small sample set of images I K The corresponding small sample set L K :
[0074] L K =ImageCaption(I K )
[0075] It is worth mentioning that models with image description generation capabilities such as BLIP or ClipCap can be used as image text description extractors.
[0076] Then use the Chinese pre-trained CLIP model to extract vector representations of small sample sets of images. and vector representation of small sample sets of text In detail, it is described as follows:
[0077] h v =f image (I K )
[0078] h l =f text (L K )
[0079] The multimodal lightweight dynamic knowledge enhancement method provided in the embodiment of the present application constructs a small sample knowledge base of images and a small sample knowledge base of texts, determines the representation to be fused and the cross-modal representation corresponding to the representation to be fused according to the corresponding knowledge base, and finally performs cross-modal fusion to obtain a fused representation after knowledge enhancement. On the basis of the powerful representation learning of the existing large-scale pre-trained multimodal model, rare and fine-grained cross-modal representation information is integrated to improve the quality of the original representation and significantly improve the retrieval efficiency of specific information.
[0080] In some embodiments, the code table of the image small sample knowledge base is a prototype representation of the normalized image vector representation corresponding to each category, and the visual words of the image small sample knowledge base are cross-modal text representations corresponding to the category.
[0081] Specifically, unlike the visual codebook in traditional computer vision, this embodiment is in the form of a multimodal visual codebook. Taking the image small sample knowledge base as an example, its code table is the prototype representation after normalization of each type of image vector representation, and the visual words are the K cross-modal text representations corresponding to the category, and the same is true for the text knowledge base.
[0082] Figure 2 : is a schematic diagram of a small sample knowledge base provided in an embodiment of the present application. The construction process of the small sample knowledge base is as follows:
[0083] 1. Merge the representations of the same category, and then regularize them to finally get the prototype representation of each category. In this way, there are N image prototype representations for each small sample set of images and texts:
[0084]
[0085] Here, ψ(·) represents the representation merging method adopted by the example of the present invention, which can be average pooling, that is, adding all K representations and then dividing by K to obtain the average representation, weighted averaging, maximum pooling that takes the maximum value of the K representations in each feature dimension, or using an attention mechanism to merge representations of the same category.
[0086] 2. Calculate the mean μ and variance δ of the K vector representations for each category in the image and text small sample representation set, and then calculate the threshold θ according to the following formula for dynamic update of the knowledge base during the reasoning process:
[0087] θ=μ-2δ
[0088] 3. The prototype representation is used as the code table of each image and the small sample knowledge base. Image small sample knowledge base D v The code table is the image prototype representation U v , each codeword The corresponding visual representation is the text small sample representation set h l K text representations and corresponding thresholds under the i-th category in Text small sample knowledge base D l The code table is the text prototype representation U l , each codeword The corresponding visual representation is the image small sample representation set h v There are K image representations and corresponding thresholds under the j-th category in .
[0089] The multimodal lightweight dynamic knowledge enhancement method provided in the embodiment of the present application constructs a small sample knowledge base of images and a small sample knowledge base of texts, determines the cross-modal representation corresponding to the representation to be fused according to the corresponding knowledge base, and finally performs cross-modal fusion to obtain a fused representation after knowledge enhancement. On the basis of the powerful representation learning of the existing large-scale pre-trained multimodal model, rare and fine-grained cross-modal representation information is integrated to improve the quality of the original representation and significantly improve the retrieval efficiency of specific information.
[0090] In some embodiments, the fusing the representation to be fused and the cross-modal representation to obtain a knowledge-enhanced fused representation includes:
[0091] The representation to be fused and the cross-modal representation are input into a fusion module to obtain a knowledge-enhanced fusion representation output by the fusion module, wherein the fusion module is determined based on a contrastive learning loss function.
[0092] Specifically, for each retrieval request, a cross-modal representation corresponding to the retrieval request representation is found from the knowledge base of the corresponding modality through a single-modal search, and input into the fusion layer for cross-modal fusion pre-training to obtain a shallow network with cross-modal representation fusion capabilities.
[0093] Figure 3 is a framework diagram of cross-modal representation pre-training provided in an embodiment of the present application, such as Figure 3 As shown, the specific steps are as follows:
[0094] 1. Build a shallow Transformer representation fusion module, including: multi-head attention module, feedforward neural network, normalization layer, and random initialization parameters.
[0095] 2. Through the single-mode search method, search in the code table of the corresponding knowledge base to find the representation h of the search request (·) The most similar code table item, obtain K cross-modal representations of the item:
[0096]
[0097]
[0098] Among them, φ(·) represents a certain single-mode search method, and They represent the K retrieved cross-modal representations respectively.
[0099] It is worth mentioning that unimodal search means that the representation of the retrieval request is consistent with the modality of the code table in the small sample knowledge base. Taking text-to-image retrieval as an example, the retrieval text is encoded by the text encoder of the Chinese pre-trained CLIP to obtain the text retrieval representation h l , and then in the text small sample knowledge base D l Code table U l , where φ(·) can be a distance metric function such as cosine similarity and KNN.
[0100] 3. Input the query request representation and the queried cross-modal representation into the Transformer representation fusion module constructed in S4.1, and output the fused representation:
[0101] z v =Fusion(h v , T emb )
[0102] z l =Fusion(h l , V emb )
[0103] 4. Furthermore, in order to enable the Transformer module to have the ability of cross-modal fusion, the InfoNCE loss function in contrastive learning is used to maximize the similarity between positive samples and minimize the similarity between negative samples, thereby better optimizing the representation learning ability of the Transformer fusion module. The specific formula is as follows:
[0104]
[0105]
[0106]
[0107] in, and Respectively represent the similarity between small batch images and texts and the similarity between small batch texts and images, sim(x, y) represents the similarity between x and y, which can be in the form of two vector dot products or cosine similarity. Furthermore, in order to allow the fused representation to consider richer semantic information in different representations as much as possible, in the embodiment of the present invention, a triple contrastive learning similarity loss is used, that is, the similarity between fused representations and the similarity between fused representations and unfused representations, as described in the following formula:
[0108]
[0109] Among them, Z v and Z l Represent the image and text fusion representation sets respectively, It is to align the fusion representations; I v and T l They represent the small batch original representations for retrieval requests obtained by Chinese pre-training CLIP, and the corresponding formulas are The last two terms of represent the alignment between the fused representation and the unfused representation. After the above steps, a shallow module with cross-modal representation fusion capability is obtained.
[0110] The multimodal lightweight dynamic knowledge enhancement method provided in the embodiment of the present application effectively enriches the semantic information in the representation of different modalities by pre-training only a shallow cross-modal fusion layer, eliminating the need for fine-tuning the original Backbone, thereby significantly saving computing resource consumption and training cost overhead. This lightweight fusion layer demonstrates excellent generalization performance in the embodiment and fully exploits the complementarity between different modal information. In addition, the lightweight design of the present invention makes it very suitable for fast and large-scale real-time retrieval scenarios in reality, providing an efficient and energy-saving multimodal information processing solution.
[0111] In some embodiments, the method further comprises:
[0112] When the preset timer expires, determining a second threshold based on the knowledge-enhanced fusion representation, where the second threshold is a threshold corresponding to the cross-modal representation;
[0113] When the second threshold and the first threshold meet a preset condition, the visual representation or text representation corresponding to the first threshold is replaced by the cross-modal representation.
[0114] In some embodiments, when the second threshold and the first threshold meet a preset condition, replacing the visual representation or text representation corresponding to the first threshold with the cross-modal representation includes:
[0115] When the second threshold is not less than the first threshold, the visual representation or text representation corresponding to the first threshold is replaced with the cross-modal representation.
[0116] Specifically, in the downstream task reasoning stage, the knowledge-enhanced representation z is used (·) Perform subsequent information retrieval and calculate the update threshold of the knowledge base at regular intervals to achieve dynamic updating of the knowledge base.
[0117] Figure 4 is a flow chart of updating a dynamic small sample knowledge base provided in an embodiment of the present application, such as Figure 4 As shown in Figure 2, the steps for updating the dynamic small sample knowledge base based on threshold are as follows:
[0118] 401. Initialize a random number as the timer for the first update, i.e., the preset timer. After each successful update of the knowledge base, the next update timer will be randomly generated. The text small sample knowledge base and the image small sample knowledge base use the same update timer.
[0119] 402, the table after waiting for the update time to arrive, the calculation uses knowledge to enhance the query The threshold θ of the retrieved Top-K cross-modal representations i ′, which is the second threshold.
[0120] Specifically, taking text-to-image retrieval as an example, we first use the knowledge-enhanced text fusion representation i indicates that the text belongs to the i-th specific information category, and the cross-modal representation of Top-K is retrieved using cosine similarity, and the update threshold θ is calculated based on the mean and variance. i ′, search the text knowledge base for the threshold θ stored under the Top-1 category codeword i , which is the first threshold.
[0121] 403. The threshold value θ stored in the corresponding category in the knowledge basei Compare and determine whether the update conditions are met.
[0122] 404. If the update condition θ is met i ′≥θ i , the retrieved Top-K cross-modal representation replaces the visual representation of the i-th category in the original knowledge base.
[0123] 405. Otherwise, no update is performed. In the subsequent reasoning process, it is necessary to determine whether the update condition is met each time until the update condition is met. After a new round of updating of the knowledge base, the random calculator is regenerated and started, and the process returns to step 402.
[0124] The multimodal lightweight dynamic knowledge enhancement method provided in the embodiment of the present application adopts a dynamic small sample knowledge base update strategy based on representation threshold, which effectively realizes the dynamic information update of the knowledge base in the retrieval embodiment. This strategy enables the fusion representation used for retrieval to flexibly incorporate the newly added fine-grained information in the embodiment, thereby enhancing its adaptability, thereby effectively coping with various practical scenarios of rare data retrieval.
[0125] Figure 5 is a structural diagram of a text answer multimodal lightweight dynamic knowledge enhancement device provided in an embodiment of the present application, such as Figure 5 As shown, the multimodal lightweight dynamic knowledge enhancement device provided in the embodiment of the present application includes a first construction module 501, a first determination module 502, and a first fusion module 503, wherein:
[0126] A first construction module 501 is used to construct an image small sample knowledge base and a text small sample knowledge base in the form of a multimodal visual codebook based on the vector representation of the image small sample set and the vector representation of the text small sample set;
[0127] A first determination module 502 is used to determine the cross-modal representation corresponding to the representation to be fused from the image small sample knowledge base or the text small sample knowledge base based on a unimodal search method;
[0128] The first fusion module 503 is used to fuse the representation to be fused and the cross-modal representation to obtain a fused representation after knowledge enhancement.
[0129] In some embodiments, the multimodal lightweight dynamic knowledge enhancement device further includes:
[0130] The first acquisition module is used to acquire the vector representation of the image small sample set and the vector representation of the text small sample set.
[0131] In some embodiments, the first acquisition module includes:
[0132] A first acquisition submodule is used to acquire a preliminary training data set;
[0133] A second acquisition submodule is used to acquire a small sample set of images and a small sample set of text based on the preliminary training data set;
[0134] The third acquisition submodule is used to acquire the vector representation of the small sample set of images and the vector representation of the small sample set of text based on the comparative language image pre-trained CLIP model.
[0135] In some embodiments, the multimodal lightweight dynamic knowledge enhancement device further includes:
[0136] A second determination module, configured to determine a second threshold based on the knowledge-enhanced fusion representation when a preset timer expires, wherein the second threshold is a threshold corresponding to the cross-modal representation;
[0137] The first processing module is used to replace the visual representation or text representation corresponding to the first threshold with the cross-modal representation when the second threshold and the first threshold meet a preset condition.
[0138] In some embodiments, the first processing module includes:
[0139] The first processing submodule is configured to replace the visual representation or textual representation corresponding to the first threshold with the cross-modal representation when the second threshold is not less than the first threshold.
[0140] In some embodiments, the code table of the image small sample knowledge base is a prototype representation of the normalized image vector representation corresponding to each category, and the visual words of the image small sample knowledge base are cross-modal text representations corresponding to the category.
[0141] In some embodiments, the first fusion module includes:
[0142] The fourth acquisition submodule is used to input the representation to be fused and the cross-modal representation into a fusion module to obtain the knowledge-enhanced fusion representation output by the fusion module, and the fusion module is determined based on the contrastive learning loss function.
[0143] Specifically, the above-mentioned multimodal lightweight dynamic knowledge enhancement device provided in the embodiment of the present application can implement all the method steps implemented in the above-mentioned multimodal lightweight dynamic knowledge enhancement method embodiment, and can achieve the same technical effect. The parts and beneficial effects that are the same as the method embodiment in this embodiment will not be described in detail here.
[0144] Figure 6 is a schematic diagram of the physical structure of an electronic device provided in an embodiment of the present application, such as Figure 6As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the multimodal lightweight dynamic knowledge enhancement method, which includes:
[0145] Based on the vector representation of the small sample set of images and the vector representation of the small sample set of text, a small sample knowledge base of images and a small sample knowledge base of text are constructed in the form of a multimodal visual codebook;
[0146] Determining the cross-modal representation corresponding to the representation to be fused from the image small sample knowledge base or the text small sample knowledge base based on a single-modal search method;
[0147] The representation to be fused and the cross-modal representation are fused to obtain a knowledge-enhanced fusion representation.
[0148] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.
[0149] In some embodiments, the method further comprises:
[0150] Get vector representations of small sample sets of images and vector representations of small sample sets of text.
[0151] In some embodiments, the step of obtaining the vector representation of the small sample set of images and the vector representation of the small sample set of texts includes:
[0152] Get the preparatory training data set;
[0153] Acquire a small sample set of images and a small sample set of text based on the preliminary training data set;
[0154] Based on the contrastive language image pre-trained CLIP model, vector representations of the small sample set of images and vector representations of the small sample set of texts are obtained.
[0155] In some embodiments, the method further comprises:
[0156] When the preset timer expires, determining a second threshold based on the knowledge-enhanced fusion representation, where the second threshold is a threshold corresponding to the cross-modal representation;
[0157] When the second threshold and the first threshold meet a preset condition, the visual representation or text representation corresponding to the first threshold is replaced by the cross-modal representation.
[0158] In some embodiments, when the second threshold and the first threshold meet a preset condition, replacing the visual representation or text representation corresponding to the first threshold with the cross-modal representation includes:
[0159] When the second threshold is not less than the first threshold, the visual representation or text representation corresponding to the first threshold is replaced with the cross-modal representation.
[0160] In some embodiments, the code table of the image small sample knowledge base is a prototype representation of the normalized image vector representation corresponding to each category, and the visual words of the image small sample knowledge base are cross-modal text representations corresponding to the category.
[0161] In some embodiments, the fusing the representation to be fused and the cross-modal representation to obtain a knowledge-enhanced fused representation includes:
[0162] The representation to be fused and the cross-modal representation are input into a fusion module to obtain a knowledge-enhanced fusion representation output by the fusion module, wherein the fusion module is determined based on a contrastive learning loss function.
[0163] Specifically, the above-mentioned electronic device provided in the embodiment of the present application can implement all the method steps implemented by the method embodiment in which the execution subject is the electronic device, and can achieve the same technical effect. The parts and beneficial effects of this embodiment that are the same as the method embodiment will not be described in detail here.
[0164] On the other hand, the present invention further provides a computer program product, the computer program product comprising a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer can execute the multimodal lightweight dynamic knowledge enhancement method provided by the above methods, the method comprising:
[0165] Based on the vector representation of the small sample set of images and the vector representation of the small sample set of text, a small sample knowledge base of images and a small sample knowledge base of text are constructed in the form of a multimodal visual codebook;
[0166] Determining the cross-modal representation corresponding to the representation to be fused from the image small sample knowledge base or the text small sample knowledge base based on a single-modal search method;
[0167] The representation to be fused and the cross-modal representation are fused to obtain a knowledge-enhanced fusion representation.
[0168] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to perform the multimodal lightweight dynamic knowledge enhancement method provided by the above methods, the method comprising:
[0169] Based on the vector representation of the small sample set of images and the vector representation of the small sample set of text, a small sample knowledge base of images and a small sample knowledge base of text are constructed in the form of a multimodal visual codebook;
[0170] Determining the cross-modal representation corresponding to the representation to be fused from the image small sample knowledge base or the text small sample knowledge base based on a single-modal search method;
[0171] The representation to be fused and the cross-modal representation are fused to obtain a knowledge-enhanced fusion representation.
[0172] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may 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 labor.
[0173] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0174] It should also be noted that the terms "first", "second", etc. in the embodiments of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first" and "second" are generally of the same type, and the number of objects is not limited. For example, the first object can be one or more.
[0175] In the embodiments of the present application, the term "and / or" describes the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.
[0176] In the embodiments of the present application, the term "plurality" refers to two or more than two, and other quantifiers are similar.
[0177] In this application, "determine B based on A" means that the factor A should be considered when determining B. It is not limited to "B can be determined based on A alone", but should also include: "determine B based on A and C", "determine B based on A, C and E", "determine C based on A, and further determine B based on C", etc. In addition, it can also include taking A as a condition for determining B, for example, "when A meets the first condition, use the first method to determine B"; for example, "when A meets the second condition, determine B", etc.; for example, "when A meets the third condition, determine B based on the first parameter", etc. Of course, it can also be a condition that takes A as a factor for determining B, for example, "when A meets the first condition, use the first method to determine C, and further determine B based on C", etc.
[0178] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A multimodal lightweight dynamic knowledge enhancement method, characterized in that: include: Based on the vector representation of the small sample set of images and the vector representation of the small sample set of text, a small sample knowledge base of images and a small sample knowledge base of text are constructed in the form of a multimodal visual codebook; Determining a cross-modal representation corresponding to the representation to be fused from the image small sample knowledge base or the text small sample knowledge base based on a unimodal search method; The representation to be fused and the cross-modal representation are fused to obtain a knowledge-enhanced fusion representation.
2. The multimodal lightweight dynamic knowledge enhancement method according to claim 1, characterized in that: The method further comprises: Get vector representations of small sample sets of images and vector representations of small sample sets of text.
3. The multimodal lightweight dynamic knowledge enhancement method according to claim 2, characterized in that: The obtaining of the vector representation of the small sample set of images and the vector representation of the small sample set of texts includes: Get the preparatory training data set; Acquire a small sample set of images and a small sample set of text based on the preliminary training data set; Based on the contrastive language image pre-trained CLIP model, vector representations of the small sample set of images and vector representations of the small sample set of texts are obtained.
4. The multimodal lightweight dynamic knowledge enhancement method according to claim 1, characterized in that: The method further comprises: When the preset timer expires, determining a second threshold based on the knowledge-enhanced fusion representation, where the second threshold is a threshold corresponding to the cross-modal representation; When the second threshold and the first threshold meet a preset condition, the visual representation or text representation corresponding to the first threshold is replaced by the cross-modal representation.
5. The multimodal lightweight dynamic knowledge enhancement method according to claim 4, characterized in that: When the second threshold and the first threshold meet a preset condition, replacing the visual representation or text representation corresponding to the first threshold with the cross-modal representation includes: When the second threshold is not less than the first threshold, the visual representation or text representation corresponding to the first threshold is replaced with the cross-modal representation.
6. The multimodal lightweight dynamic knowledge enhancement method according to claim 1, characterized in that: The code table of the image small sample knowledge base is a prototype representation after normalization of the image vector representation corresponding to each category, and the visual words of the image small sample knowledge base are cross-modal text representations corresponding to the category.
7. The multimodal lightweight dynamic knowledge enhancement method according to claim 1, characterized in that: The fusing the representation to be fused and the cross-modal representation to obtain a knowledge-enhanced fused representation includes: The representation to be fused and the cross-modal representation are input into a fusion module to obtain a knowledge-enhanced fusion representation output by the fusion module, wherein the fusion module is determined based on a contrastive learning loss function.
8. A multimodal lightweight dynamic knowledge enhancement device, characterized in that: include: A first construction module is used to construct an image small sample knowledge base and a text small sample knowledge base in the form of a multimodal visual code book based on the vector representation of the image small sample set and the vector representation of the text small sample set; A first determination module is used to determine the cross-modal representation corresponding to the representation to be fused from the image small sample knowledge base or the text small sample knowledge base based on a unimodal search method; The first fusion module is used to fuse the representation to be fused and the cross-modal representation to obtain a fused representation after knowledge enhancement.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the program, the multimodal lightweight dynamic knowledge enhancement method as described in any one of claims 1 to 7 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the multimodal lightweight dynamic knowledge enhancement method as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Video common sense text generation method based on unstructured knowledge embedding
CN115393773A
Generative dialogue method and system based on multi-modal knowledge enhancement
CN116450787A
Multi-modal fusion named entity recognition method and device based on debiasing contrast learning, medium and product
CN117010389A
Remote sensing image text retrieval method based on remote sensing multi-modal basic model
CN117743614A
Multimodal content processing method, apparatus, device and storage medium
US20210192142A1
