Hybrid expert target detection system and method
Through the hybrid expert target detection system, the image-text modal fusion and scene semantic understanding of the gated neural network and multi-expert fusion system are used to solve the problem of insufficient generalization ability of the traditional target detection system in unknown categories and diverse scenes. High-precision and widely applicable target detection is achieved.
Patent Information
- Application Number
- CN202410821561.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-09-20
AI Technical Summary
Traditional target detection systems lack generalization capabilities and cannot work robustly when dealing with unknown categories and diverse scenes, and their detection accuracy still has room for improvement compared with traditional methods.
A hybrid expert target detection system is used, combined with a gated neural network and a multi-expert fusion system, to perform image-text modal fusion through encoders, decoders and routers, obtain scene semantic information and select the optimal expert model for target detection, achieving multi- Efficient utilization of modal information and scene semantic understanding.
It improves the generalization ability and detection accuracy of the model, is suitable for a variety of complex scenarios, significantly improves the performance on different data sets, and demonstrates strong generalization and migration capabilities.
Smart Images

Figure CN118675030A
Abstract
Description
Technical Field
[0001] This document relates to the field of target detection technology, and in particular to a hybrid expert target detection system and method. Background Art
[0002] Object detection is an important task in the field of computer vision, which aims to identify and locate specific target objects in images. Conventional targets usually rely on training sets, and their performance is highly dependent on the categories contained in the training data. When encountering new categories that are not labeled in the training set, these systems are usually unable to correctly identify or classify them. This means that traditional detectors lack generalization capabilities and cannot work robustly in different scenarios.
[0003] To solve these problems, researchers proposed the concept of open vocabulary detection. Open vocabulary detection aims to build object detection models that can handle unknown categories and diverse scenarios. These models must not only be able to detect and classify known objects, but also be able to recognize and adapt to unknown new categories. However, they still have some characteristics and limitations in practical applications. Although open vocabulary detectors are designed to improve adaptability to new categories and diverse scenarios, current methods still have a lot of room for improvement in detection accuracy compared to traditional object detection, and the generalization ability they demonstrate still depends on their training sets. First, because its model architecture only applies modules with generalization capabilities to objects, it relatively ignores the importance of scenes to objects. Second, due to its limited generalization ability of a single model, it cannot make full use of its training data.
[0004] Faced with the limited ability to process complex scenes and changing conditions in the real world, there is an urgent need for a hybrid target detection method based on a multi-expert model guided by scene semantics. Summary of the invention
[0005] The present invention provides a hybrid expert target detection system and method, aiming to solve the above problems.
[0006] The present invention provides a hybrid expert target detection system, comprising:
[0007] A gated neural network and a multi-expert fusion system, wherein the gated neural network is obtained based on a pre-training task and includes: an encoder, a decoder, and a router;
[0008] The encoder is used to encode the input image and the prompt text in the image to obtain the image-text modality fusion vector;
[0009] The decoder is used to decode the image-text modality fusion vector to obtain a scene semantic information vector, where the scene semantic information vector includes: an object entity vector and an environment entity vector;
[0010] The router is used to obtain an optimal expert model according to the scene semantic information vector;
[0011] The multi-expert fusion system is used to call the corresponding model according to the optimal expert model to perform target detection on the image.
[0012] The present invention provides a hybrid expert target detection method, comprising:
[0013] Pre-training the gated neural network to obtain a trained gated neural network;
[0014] The input image and the prompt text in the image are encoded through the encoder in the gated neural network to obtain the image-text modality fusion vector;
[0015] Decoding the image-text modality fusion vector through a decoder in a gated neural network to obtain a scene semantic information vector, wherein the scene semantic information vector includes: an object entity vector and an environment entity vector;
[0016] The optimal expert model is obtained according to the scene semantic information vector through the router in the gated neural network;
[0017] The multi-expert fusion system is used to call the corresponding model according to the optimal expert model to perform target detection on the image.
[0018] By adopting the embodiments of the present invention, the following beneficial effects are achieved:
[0019] (1) Combining computer vision and natural language processing, the method makes full use of computer vision and natural language processing technologies to achieve efficient use of multimodal information. It combines the high-precision characteristics of traditional target detection and the generalization ability of open vocabulary detection to achieve the characteristics of strong generalization ability and high detection accuracy.
[0020] (2) A multi-expert fusion system was designed, which can call multiple expert models for collaborative detection, use a gated network to extract scene semantics, and adopt an efficient image-text encoder for feature fusion to achieve efficient scene semantic understanding. It can select the most appropriate expert model according to different scenarios, which improves the comprehensiveness and adaptability of the model. It also supports the expansion of new experts through incremental learning, which improves the versatility and scalability of detection.
[0021] (3) It has a wide range of applicable scenarios and is suitable for target detection in a variety of complex scenarios, such as dense crowd scenes, foggy weather scenes, remote sensing image scenes, remote sensing ship scenes, driving scenes, night scenes, drone scenes, etc. Experiments have shown that it has achieved significant improvements on multiple data sets, demonstrating strong generalization and migration capabilities. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate one or more embodiments of this specification 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 recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0023] Figure 1 A schematic diagram of a hybrid expert target detection system according to an embodiment of the present invention;
[0024] Figure 2 A framework diagram of a hybrid expert target detection system according to an embodiment of the present invention;
[0025] Figure 3 A schematic diagram of a gated neural network expert routing of a hybrid expert target detection system according to an embodiment of the present invention;
[0026] Figure 4 Schematic diagram of the structure of an image-text encoder according to an embodiment of the present invention;
[0027] Figure 5 Schematic diagram of a cross-modal feature fusion network in an image-text encoder according to an embodiment of the present invention;
[0028] Figure 6 A schematic diagram of the structure of a decoder according to an embodiment of the present invention;
[0029] Figure 7 A schematic diagram of a pre-training task according to an embodiment of the present invention;
[0030] Figure 8 A schematic diagram of an expert fusion system according to an embodiment of the present invention;
[0031] Fig. 9 Flow chart of the hybrid expert target detection method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0032] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the following will be combined with the drawings in one or more embodiments of this specification to clearly and completely describe the technical solutions in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.
[0033] System Example
[0034] According to an embodiment of the present invention, a hybrid expert target detection system is provided. Figure 1 is a schematic diagram of a hybrid expert target detection system according to an embodiment of the present invention. Figure 1 As shown, the hybrid expert target detection system of the embodiment of the present invention specifically includes:
[0035] A gated neural network and a multi-expert fusion system, wherein the gated neural network is obtained based on a pre-training task and includes: an encoder, a decoder, and a router;
[0036] The pre-training of the gated neural network includes: using the image-text dataset to pre-train the encoder and decoder in the gated neural network, specifically including: inputting the image into the encoder and decoder, outputting the scene semantic information vector, and adjusting the parameters of the encoder and decoder through the loss. Inputting the image into the encoder and decoder to output the scene semantic information vector; using the scene semantic information vector to train the router in the gated neural network, specifically including: inputting the scene semantic information vector into the router, predicting the optimal expert model, and adjusting the parameters of the router through the loss function.
[0037] The encoder is used to encode the input image and the prompt text in the image to obtain the image-text modality fusion vector;
[0038] The encoder of the embodiment of the present invention adopts an image-text encoder (IT-Encoder), which mainly includes an image feature encoder (Image-Encoder), a text feature encoder (Text-Encoder), and a cross-modal feature fusion network (Fusion-Network), such as Figure 4 FIG. 1 is a schematic diagram of the structure of an image-text encoder according to an embodiment of the present invention;
[0039] The image feature encoder (Image-Encoder) uses Vision Transformer as the image encoder, which divides the input image into multiple blocks and encodes them into a set of embeddings {v cls ,v1,v2,…,v M}, where v cls is an embedding of the [CLS] tag;
[0040] The text feature encoder (Text-Encoder) uses Transformer as the text encoder. The input text is fed into the text encoder and encoded into a set of embeddings {l cls ,l1,l2,…,l N}, where l cls is an embedding of the [CLS] tag;
[0041] The cross-modal feature fusion network (Fusion-Network) consists of multiple N skip connection fusion blocks, where N is a hyperparameter. In the first skip connection fusion block, the image features and text features from the image feature encoder (Image-Encoder) and the text feature encoder (Text-Encoder) are composed [v 1 ; l 1 ],[v 1 ; l 1 ] Input the jump connection fusion block and output the fused image features and text features [v 2 ; l 2 ], then each block jumps to connect the image features and text features of the fusion block to input [v n ; l n ] are all the outputs of the previous skip connection fusion block [v n-1 ; l n-1 ], thereby achieving the gradual integration and deepening of features.
[0042] In one example, a cross-modal feature fusion network is constructed in the following way:
[0043] The cross-modal feature fusion network (Fusion-Network) includes N skip connection fusion blocks, such as Figure 5 As shown, the skip connection fusion block includes S asymmetric collaborative attention layers and one connection attention layer, where S is a hyperparameter;
[0044] The asymmetric collaborative attention layer consists of a self-attention (SA) layer, a cross-attention (CA) layer, and a feed-forward network (FFN) layer. Specifically, the text feature l n-1 First, it is processed by the self-attention (SA) layer, and then the visual feature v n-1 Through the cross attention layer and text features Fusion, get The outputs of the self-attention (SA) layer and the cross-attention (CA) layer are added and then input into the feed-forward network (FFN) layer to obtain the visually perceived text representation l n :
[0045]
[0046]
[0047] Where LN represents layer normalization;
[0048] The connected attention layer consists of a self-attention (SA) layer and a feed-forward network (FFN) layer, which converts the image feature v n-1 and the input text features l n-1Connect to [v n-1 ; l n-1 ], where l n-1 is the output of the asymmetric co-attention layer. The concatenated image and text features [v n-1 ; l n-1 ] is input to the self-attention (SA) layer and the feed-forward network (FFN) layer to obtain the final feature representation [v n ; l n ]:
[0049]
[0050] [v n ; l n ] is the output of the jump connection fusion block and is input into the next jump connection fusion block. Represents the output of the self-attention layer SA in the connected attention layer;
[0051] Finally, the output of the Nth jump connection fusion block [v N ; l N ] are simultaneously input into the object entity decoder (Object-Decoder) and the environment entity decoder (Scene-Decoder) for sequence-to-sequence learning.
[0052] The decoder is used to decode the image-text modality fusion vector to obtain a scene semantic information vector, which includes: an object entity vector and an environment entity vector; wherein the object entity vector refers to the feature representation of the main object in the scene, and the environment entity is the feature representation of the environment in the scene.
[0053] The decoder of the embodiment of the present invention includes: an object entity decoder and an environment entity decoder, the object entity decoder (Object-Decoder) is used to decode the image-text modality fusion vector to obtain the object entity vector in the scene semantic information; the environment entity decoder (Scene-Decoder) is used to decode the image-text modality fusion vector to obtain the environment entity vector in the scene semantic information.
[0054] The object entity decoder and the scene entity decoder have the same structure: the object entity decoder (Object-Decoder) and the scene entity decoder (Scene-Decoder), which output the object entity vector and the scene entity vector respectively. The decoder consists of M decoding blocks, each of which includes a causal self-attention (CSA) layer, a cross attention (CA) layer, and a feed-forward network (FFN) layer. M is a hyperparameter.
[0055] Input text features l m-1It is first fed into the causal self-attention (CLS) layer, and then the encoder output [v N ,l N ]Through the cross attention (CA) layer and text features Fusion, get The outputs of the causal self-attention (CSA) layer and the cross attention (CA) layer are added and then input into the feed-forward network (FFN) layer to obtain the mth block text feature l m :
[0056]
[0057] Where LN represents layer normalization;
[0058] Finally, the Mth decoding block outputs l M Decoder output.
[0059] The gated neural network pre-training tasks of the embodiment of the present invention include: image-text comparison (ITC), image-text matching (ITM), mask language modeling (MLM), prefix language modeling 1 (PrefixLM1), prefix language modeling 2 (PrefixLM2);
[0060] Image-Text Contrast (ITC): The gated neural network uses this task to align the image features and text features output by the image feature encoder (Image-Encoder) and the text feature encoder (Text-Encoder);
[0061] Image-text matching (ITM): Gated neural networks use this task to calculate whether the predicted image and sentence match in cross-modal representation;
[0062] Masked Language Modeling (MLM): A gated neural network randomly masks 15% of tokens in the text and requires the model to predict these masked words using cross-modal representations;
[0063] Prefix Language Modeling 1 (PrefixLM1): A gated neural network uses this task to generate context entity vectors for input images;
[0064] Prefix Language Modeling 2 (PrefixLM2): A gated neural network uses this task to generate object entity vectors for input images.
[0065] Image-text comparison (ITC) defines a similarity function to measure the similarity between image-text pairs:
[0066]
[0067] where g v and gw is a linear transformation that maps the [CLS] embedding to a normalized low-dimensional (256-dimensional) representation;
[0068] Image-text comparison (ITC) uses two dynamic queues to store M image-text features, denoted as g′ v (v′ cls ) and g′ w (l′ cls ).definition For each image-text pair, calculate the softmax-normalized image-to-text and text-to-image similarities:
[0069]
[0070] Among them, τ is a learnable temperature parameter, let y i2t (I) and y t2i (T) represents the true one-hot similarity, where the probability of negative samples is 0 and the probability of positive samples is 1. The image-text contrast loss is defined as the cross entropy H between p and y, and the loss function satisfies:
[0071]
[0072] ITM predicts whether a pair of images and text is a positive sample (match) or a negative sample (mismatch). The output embedding of the [CLS] tag of the cross-modal feature fusion network (Fusion-Network) is used as the joint representation of the image-text pair, and a fully connected (FC) layer is attached, followed by a softmax to predict the two-class probability p itm The loss function satisfies:
[0073]
[0074] Among them, y itm is a two-dimensional one-hot vector representing the true label.
[0075] Masked Language Modeling (MLM) uses images and contextual text to predict masked words. Masked Language Modeling (MLM) randomly masks input tokens with a probability of 15% and replaces them with a special token [MASK]. Indicates the masked text. represents the model's predicted probability of the masked mark. The cross entropy loss function satisfies:
[0076]
[0077] Prefix Language Modeling 1 (PrefixLM1) generates context entity vectors for the input image and predicts the text paragraph following the cross-modal context. Training is performed by maximizing the log-likelihood of the real text output by the Scene-Decoder, where the likelihood function satisfies:
[0078]
[0079] in, Represents a context collection, Represents the collection of text to be generated.
[0080] Prefix Language Modeling 2 (PrefixLM2) generates object entity vectors for input images and predicts text paragraphs following cross-modal context. Training is performed by maximizing the log-likelihood of the real text output by the object-decoder, where the likelihood function satisfies:
[0081]
[0082] in, Represents a context collection, Represents the collection of text to be generated.
[0083] Gated neural network pre-training performs joint training on image-text comparison (ITC), image-text matching (ITM), mask language modeling (MLM), prefix language modeling 1 (PrefixLM1), and prefix language modeling 2 (PrefixLM2) tasks, and the total loss function satisfies:
[0084]
[0085] The router is used to obtain the optimal expert model according to the scene semantic information vector. In the embodiment of the present invention, the training of the router includes:
[0086] The environment entities and object entities are combined into scene semantic information, and a router is trained using the scene semantic information. The router is a multi-layer perceptron (MLP). Let X represent the input scene semantic information, y represent the corresponding classification label, f(X; θ) represent the predicted optimal expert output of the MLP model, where θ is the model parameter. Loss function Defined as the cross entropy loss, the cross entropy loss function satisfies:
[0087]
[0088] Where N represents the number of training samples, y i represents the true label of the i-th sample, f(X i; θ) represents the predicted probability of MLP for the i-th sample.
[0089] The multi-expert fusion system is used to call the corresponding model according to the optimal expert model to perform target detection on the image.
[0090] The multi-expert fusion system in the embodiment of the present invention includes: Figure 8 The expert models trained for multiple different scenarios are shown, including but not limited to dense crowd scene expert model, foggy weather scene expert model, remote sensing image scene expert model, remote sensing ship scene expert model, driving scene expert model, night scene expert model, and drone scene expert model;
[0091] Construct middleware to align different expert interfaces, input the image and the prediction results of the optimal expert model output by the router into the multi-expert fusion system, and the multi-expert fusion system calls the corresponding expert model to perform target detection on the input image, such as Figure 2 FIG. 1 is a framework diagram of a hybrid expert target detection system according to an embodiment of the present invention. Figure 3 Schematic diagram of gated neural network expert routing according to an embodiment of the present invention.
[0092] In the embodiment of the present invention, the multi-expert collaborative detection step can be performed online or offline. Online means obtaining scene semantic information in real time and selecting the optimal expert model for detection. Offline means obtaining and storing scene semantic information in advance, and selecting the optimal expert model for detection according to the scene semantic information during detection.
[0093] The hybrid expert target detection system provided by the embodiment of the present invention is applicable to target detection fields, such as autonomous driving, robot vision, video surveillance, etc.
[0094] The following beneficial effects are achieved by adopting the embodiments of the present invention:
[0095] (1) Combining computer vision and natural language processing, the method makes full use of computer vision and natural language processing technologies to achieve efficient use of multimodal information. It combines the high-precision characteristics of traditional target detection and the generalization ability of open vocabulary detection to achieve the characteristics of strong generalization ability and high detection accuracy.
[0096] (2) A multi-expert fusion system was designed, which can call multiple expert models for collaborative detection, use a gated network to extract scene semantics, and adopt an efficient image-text encoder for feature fusion to achieve efficient scene semantic understanding. It can select the most appropriate expert model according to different scenarios, which improves the comprehensiveness and adaptability of the model. It also supports the expansion of new experts through incremental learning, which improves the versatility and scalability of detection.
[0097] (3) It has a wide range of applicable scenarios and is suitable for target detection in a variety of complex scenarios, such as dense crowd scenes, foggy weather scenes, remote sensing image scenes, remote sensing ship scenes, driving scenes, night scenes, drone scenes, etc. Experiments have shown that it has achieved significant improvements on multiple data sets, demonstrating strong generalization and migration capabilities.
[0098] Method Embodiment
[0099] According to an embodiment of the present invention, a hybrid expert target detection system is provided. Fig. 9 is a flow chart of a hybrid expert target detection method according to an embodiment of the present invention. Fig. 9 As shown, the hybrid expert target detection method of the embodiment of the present invention specifically includes:
[0100] S91, pre-training the gated neural network to obtain a trained gated neural network;
[0101] S91 specifically includes: pre-training the encoder and decoder in the gated neural network by:
[0102] like Figure 7 As shown, the gated neural network pre-training tasks include: image-text comparison (ITC), image-text matching (ITM), mask language modeling (MLM), prefix language modeling 1 (PrefixLM1), prefix language modeling 2 (PrefixLM2);
[0103] Image-Text Contrast (ITC): The gated neural network uses this task to align the image features and text features output by the image feature encoder (Image-Encoder) and the text feature encoder (Text-Encoder);
[0104] Image-text matching (ITM): Gated neural networks use this task to calculate whether the predicted image and sentence match in cross-modal representation;
[0105] Masked Language Modeling (MLM): A gated neural network randomly masks 15% of tokens in the text and requires the model to predict these masked words using cross-modal representations;
[0106] Prefix Language Modeling 1 (PrefixLM1): A gated neural network uses this task to generate context entity vectors for input images;
[0107] Prefix Language Modeling 2 (PrefixLM2): A gated neural network uses this task to generate object entity vectors for input images.
[0108] In one example, the image-text comparison (ITC) task is constructed as follows:
[0109] Image-text comparison (ITC) defines a similarity function to measure the similarity between image-text pairs:
[0110]
[0111] where g v and g w is a linear transformation that maps the [CLS] embedding to a normalized low-dimensional (256-dimensional) representation;
[0112] Image-text comparison (ITC) uses two dynamic queues to store M image-text features, denoted as g ′ v (v c ′ ls ) and g ′ w (l ′ cls ).definition For each image-text pair, calculate the softmax-normalized image-to-text and text-to-image similarities:
[0113]
[0114] Among them, τ is a learnable temperature parameter, let y i2t (I) and y t2i (T) represents the true one-hot similarity, where the probability of negative samples is 0 and the probability of positive samples is 1. The image-text contrast loss is defined as the cross entropy H between p and y, and the loss function satisfies:
[0115]
[0116] In one example, an image-text matching (ITM) task is constructed as follows:
[0117] ITM predicts whether a pair of images and text is a positive sample (match) or a negative sample (mismatch). The output embedding of the [CLS] tag of the cross-modal feature fusion network (Fusion-Network) is used as the joint representation of the image-text pair, and a fully connected (FC) layer is attached, followed by a softmax to predict the two-class probability p itm The loss function satisfies:
[0118]
[0119] Among them, y itm is a two-dimensional one-hot vector representing the true label.
[0120] In one example, the Masked Language Modeling (MLM) task is constructed as follows:
[0121] Masked Language Modeling (MLM) uses images and contextual text to predict masked words. Masked Language Modeling (MLM) randomly masks input tokens with a probability of 15% and replaces them with a special token [MASK]. Indicates the masked text. represents the model's predicted probability of the masked mark. The cross entropy loss function satisfies:
[0122]
[0123] In one example, the Prefix Language Modeling 1 (PrefixLM1) task is constructed as follows:
[0124] Prefix Language Modeling 1 (PrefixLM1) generates context entity vectors for the input image and predicts the text paragraph following the cross-modal context. Training is performed by maximizing the log-likelihood of the real text output by the Scene-Decoder, where the likelihood function satisfies:
[0125]
[0126] in, Represents a context collection, Represents the collection of text to be generated.
[0127] In one example, the Prefix Language Modeling 2 (PrefixLM2) task is constructed as follows:
[0128] Prefix Language Modeling 2 (PrefixLM2) generates object entity vectors for input images and predicts text paragraphs following cross-modal context. Training is performed by maximizing the log-likelihood of the real text output by the object-decoder, where the likelihood function satisfies:
[0129]
[0130] in, Represents a context collection, Represents the collection of text to be generated.
[0131] Finally, in one example, the total loss function for the pre-training task is composed as follows:
[0132] The gated neural network pre-training performs joint training on image-text comparison (ITC), image-text matching (ITM), mask language modeling (MLM), prefix language modeling 1 (PrefixLM1), and prefix language modeling 2 (PrefixLM2) tasks, and the total loss function satisfies:
[0133]
[0134] In one example, a gated neural network router is constructed as follows:
[0135] Router training includes: combining environment entities and object entities into scene semantic information; using scene semantic information to train a router, which is a multi-layer perceptron (MLP). Let X represent the input scene semantic information, y represent the corresponding classification label, f(X; θ) represent the predicted optimal expert output of the MLP model, where θ is the model parameter. Loss function Defined as the cross entropy loss, the cross entropy loss function satisfies:
[0136]
[0137] Where N represents the number of training samples, y i represents the true label of the i-th sample, f(X i ; θ) represents the predicted probability of MLP for the i-th sample.
[0138] S92, encoding the input image and the prompt text in the image through an encoder in the gated neural network to obtain an image-text modality fusion vector;
[0139] S92 specifically includes:
[0140] The encoder is mainly composed of an image-text encoder (IT-Encoder), which is used to encode the input image and the prompt text to obtain an image-text modality fusion vector;
[0141] In one example, an image-text encoder (IT-Encoder) is constructed in the following way:
[0142] like Figure 4 As shown, the image-text encoder (IT-Encoder) mainly includes an image feature encoder (Image-Encoder), a text feature encoder (Text-Encoder), and a cross-modal feature fusion network (Fusion-Network);
[0143] The image feature encoder (Image-Encoder) uses Vision Transformer as the image encoder, which divides the input image into multiple blocks and encodes them into a set of embeddings {v cls ,v1,v2,…,v M}, where v cls is an embedding of the [CLS] tag;
[0144] The text feature encoder (Text-Encoder) uses Transformer as the text encoder. The input text is fed into the text encoder and encoded into a set of embeddings {l cls ,l1,l2,…,l N}, where l cls is an embedding of the [CLS] tag;
[0145] The cross-modal feature fusion network (Fusion-Network) consists of multiple N skip connection fusion blocks, where N is a hyperparameter. In the first skip connection fusion block, the image features and text features from the image feature encoder (Image-Encoder) and the text feature encoder (Text-Encoder) are composed [v 1 ; l 1 ],[v 1 ; l 1 ] Input the jump connection fusion block and output the fused image features and text features [v 2 ; l 2 ], then each block jumps to connect the image features and text features of the fusion block to input [v n ,l n ] are all the outputs of the previous skip connection fusion block [v n-1 ,l n-1 ], thereby achieving the gradual integration and deepening of features.
[0146] In one example, a cross-modal feature fusion network is constructed in the following way:
[0147] The cross-modal feature fusion network (Fusion-Network) includes N skip connection fusion blocks, such as Figure 5 As shown, the skip connection fusion block includes S asymmetric collaborative attention layers and one connection attention layer, where S is a hyperparameter;
[0148] The asymmetric collaborative attention layer consists of a self-attention (SA) layer, a cross-attention (CA) layer, and a feed-forward network (FFN) layer. Specifically, the text feature l n-1 First, it is processed by the self-attention (SA) layer, and then the visual feature vn-1 Through the cross attention layer and text features Fusion, get The outputs of the self-attention (SA) layer and the cross-attention (CA) layer are added and then input into the feed-forward network (FFN) layer to obtain the visually perceived text representation l n :
[0149]
[0150] Where LN represents layer normalization;
[0151] The connected attention layer consists of a self-attention (SA) layer and a feed-forward network (FFN) layer, which converts the image feature v n-1 and the input text features l n-1 Connect to [v n-1 ; l n-1 ], where l n-1 is the output of the asymmetric co-attention layer. The concatenated image and text features [v n-1 ; l n-1 ] is input to the self-attention (SA) layer and the feed-forward network (FFN) layer to obtain the final feature representation [v n ; l n ]:
[0152]
[0153] [v n ; l n ] is the output of the jump connection fusion block and is input into the next jump connection fusion block. Represents the output of the self-attention layer SA in the connected attention layer;
[0154] Finally, the output of the Nth jump connection fusion block [v N ; l N ] are simultaneously input into the object entity decoder (Object-Decoder) and the environment entity decoder (Scene-Decoder) for sequence-to-sequence learning.
[0155] S93, decoding the image-text modality fusion vector through a decoder in a gated neural network to obtain a scene semantic information vector, where the scene semantic information vector includes: an object entity vector and an environment entity vector;
[0156] S93 specifically includes: the decoder includes two decoders with the same structure: an object entity decoder (Object-Decoder) and an environment entity decoder (Scene-Decoder), which output object entity vectors and environment entity vectors respectively. The decoder is composed of M decoding blocks, such as Figure 6 As shown, each decoding block includes a causal self-attention (CSA) layer, a cross attention (CA) layer, and a feed-forward network (FFN) layer, and M is a hyperparameter;
[0157] Input text features l m-1 It is first fed into the causal self-attention (CSA) layer, and then the encoder output [v N ; l N ]Through the cross attention (CA) layer and text features Fusion, get The outputs of the causal self-attention (CSA) layer and the cross attention (CA) layer are added and then input into the feed-forward network (FFN) layer to obtain the mth block text feature l m :
[0158]
[0159] Where LN represents layer normalization;
[0160] Finally, the Mth decoding block outputs l M The object entity vector and the environment entity vector output by the object entity decoder (Object-Decoder) and the environment entity decoder (Scene-Decoder) respectively form a scene semantic vector and are input into the router.
[0161] S94, obtaining an optimal expert model according to the scene semantic information vector through a router in a gated neural network;
[0162] like Figure 8 The multi-expert fusion system shown uses expert models trained for multiple different scenarios, including but not limited to dense crowd scene expert models, foggy weather scene expert models, remote sensing image scene expert models, remote sensing ship scene expert models, driving scene expert models, night scene expert models, and drone scene expert models;
[0163] S95. Using a multi-expert fusion system to call a corresponding model according to the optimal expert model to perform target detection on the image.
[0164] Middleware is constructed to align different expert interfaces, and the image and the prediction result of the optimal expert model output by the router are input into the multi-expert fusion system, and the multi-expert fusion system calls the corresponding expert model to perform target detection on the input image.
[0165] 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 replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A hybrid expert target detection system, characterized in that: include: A gated neural network and a multi-expert fusion system, wherein the gated neural network is obtained based on a pre-training task and includes: an encoder, a decoder, and a router; The encoder is used to encode the input image and the prompt text in the image to obtain an image-text modality fusion vector; The decoder is used to decode the image-text modality fusion vector to obtain a scene semantic information vector, wherein the scene semantic information vector includes: an object entity vector and an environment entity vector; The router is used to obtain an optimal expert model according to the scene semantic information vector; The multi-expert fusion system is used to call the corresponding model according to the optimal expert model to perform target detection on the image.
2. The system according to claim 1, characterized in that The decoder specifically includes: an object entity decoder and an environment entity decoder; The object entity decoder is used to decode the image-text modality fusion vector to obtain an object entity vector; The environmental entity decoder is used to decode the image-text modality fusion vector to obtain an environmental entity vector.
3. The system according to claim 1, characterized in that The encoder specifically comprises: Image feature encoder, text feature encoder, and cross-modal feature fusion network; The image feature encoder is used to divide the input image into multiple blocks and encode them into a set of embeddings {v cls ,v1,v2,…,v M }, where v cls is an embedding of the [CLS] tag; The text feature encoder is used to encode the input text into a set of embeddings {l cls ,l1,l2,…,l N }, where l cls is an embedding of the [CLS] tag; The cross-modal feature fusion network is composed of N skip connection fusion blocks. The first skip connection fusion block is used to combine [v 1 ; l 1 ] merged into [v 2 ; l 2 ], then each block jumps to connect the image features and text features of the fusion block to input [v n ; l n ] are all the outputs of the previous skip connection fusion block [v n-1 ,l n-1 ], thereby achieving the gradual fusion and deepening of features, where N is a hyperparameter.
4. The system according to claim 3, characterized in that The skip connection fusion block includes S asymmetric collaborative attention layers and one connection attention layer, where S is a hyperparameter; The asymmetric collaborative attention layer includes: self-attention layer SA, cross-attention layer CA and feed-forward network layer FFN, text feature l n-1 First, the text features are obtained through the self-attention layer SA processing Image features v n-1 Through the cross attention layer CA and text features Fusion, get The outputs of the self-attention layer SA and the cross-attention layer CA are added and then input into the feed-forward network layer FFN to obtain the visually perceived text representation l n : Where LN represents layer normalization; The connection attention layer includes: a self-attention layer SA and a feed-forward network layer FFN, which converts the image feature v n-1 and the input text features l n-1 Connect to [v n-1 ; l n-1 ], where l n-1 is the output of the asymmetric collaborative attention layer, which connects the image features and text features [v n-1 ,l n-1 ] is input to the self-attention layer SA and the feed-forward network layer FFN to obtain the final feature representation [v n ; l n ]: represents the output of the self-attention layer SA in the connected attention layer, [v n ; l n ] is the output of the jump connection fusion block and is input into the next jump connection fusion block; Finally, the output of the Nth jump connection fusion block [v N ; l N ] is simultaneously input into the object entity decoder and the environment entity decoder for sequence learning.
5. The system according to claim 1, characterized in that The pre-training tasks used by the gated neural network include: image-text comparison, image-text matching, mask language modeling, first prefix language modeling, and second prefix language modeling; The image-text comparison is used to align the image features and text features output by the image feature encoder and the text feature encoder; The image-text matching task is used to calculate whether the predicted image and sentence match in cross-modal representation; The masked language modeling is used to randomly mask a preset percentage of tokens in the text and requires the model to predict these masked words using cross-modal representations; The first prefix language modeling is used to generate an environment entity vector for an input image; The second prefix language modeling is used to generate an object entity vector for an input image.
6. The system according to claim 5, characterized in that The gated neural network pre-training performs joint training on image-text comparison, image-text matching, mask language modeling, first prefix language modeling, and second prefix language modeling tasks. The total loss function satisfy: Among them, L itc represents the image-text contrast loss function, L itm represents the image-text matching loss function, L mlm represents the masked language modeling cross entropy loss function, L plm1 represents the likelihood function of the first prefix language modeling, L plm2 Represents the likelihood function for second prefix language modeling.
7. The system according to claim 6, characterized in that The image-text contrast loss function L itc The acquisition steps include: Define a similarity function to measure the similarity between image-text pairs: s=g v (v cls ) T g w (l cls ); where g v and g w is a linear transformation that maps the [CLS] embedding to a normalized low-dimensional representation; Image-text comparison uses two dynamic queues to store M image-text features, denoted as g′ v (v′ cls ) and g′ w (l′ cls ); definition For each image-text pair, calculate the softmax-normalized image-to-text and text-to-image similarities: Among them, τ is a learnable temperature parameter, y i2t (I) and y t2i (T) represents the true one-hot similarity, where the probability of a negative sample is 0 and the probability of a positive sample is 1. The image-text contrast loss is defined as the cross entropy H between p and y, and the image-text contrast loss function L itc satisfy: The image-text matching loss function L itm The acquisition steps include: The output embedding of the [CLS] tag of the cross-modal feature fusion network is used as the joint representation of the image-text pair, and a fully connected layer is attached, followed by a softmax to predict the two-class probability p itm , the image-text matching loss function satisfies: Among them, y itm is a two-dimensional one-hot vector representing the true label; The masked language modeling cross entropy loss function L mlm The acquisition steps include: Masked language modeling randomly masks input tokens with a preset percentage probability and replaces them with special tokens. Indicates the masked text. represents the model's predicted probability for the masked tag, the masked language modeling cross entropy loss function satisfy: The likelihood function L of the first prefix language modeling plm1 The acquisition steps include: Generate an environmental entity vector for the input image and predict the text paragraph after the cross-modal context. The training is performed by maximizing the log-likelihood of the real text output by the environmental entity decoder. The likelihood function L of the prefix language modeling plm1 satisfy: Among them, x represents the context set, and y represents the text set to be generated; The likelihood function L of the second prefix language modeling plm2 The acquisition steps include: Generate an object entity vector for the input image and predict the text paragraph after the cross-modal context. The training is performed by maximizing the log-likelihood of the real text output by the object entity decoder. The likelihood function L of the second prefix language modeling plm2 satisfy: Among them, x represents the context set, and y represents the text set to be generated.
8. The system according to claim 1, characterized in that The training of the router by the gated neural network specifically includes: The environment entities and object entities are combined into scene semantic information, and a router is trained using the scene semantic information. The router is a multi-layer perceptron. The loss function Defined as cross entropy loss, the cross entropy loss function satisfy: Where N represents the number of training samples, y i represents the true label of the i-th sample, f(X i ; θ) represents the predicted probability of the multilayer perceptron for the i-th sample, X represents the input scene semantic information, y represents the corresponding classification label, f(X; θ) represents the predicted optimal expert output of the multilayer perceptron model, and θ is the model parameter.
9. The system according to claim 1, characterized in that The expert fusion system includes at least one of the following: a dense crowd scene expert model, a foggy weather scene expert model, a remote sensing image scene expert model, a remote sensing ship scene expert model, a driving scene expert model, a night scene expert model, and a drone scene expert model.
10. A hybrid expert target detection method, characterized in that: include: Pre-training the gated neural network to obtain a trained gated neural network; The input image and the prompt text in the image are encoded through the encoder in the gated neural network to obtain the image-text modality fusion vector; Decoding the image-text modality fusion vector through a decoder in a gated neural network to obtain a scene semantic information vector, wherein the scene semantic information vector includes: an object entity vector and an environment entity vector; Obtaining an optimal expert model according to the scene semantic information vector through a router in a gated neural network; A multi-expert fusion system is used to call a corresponding model according to the optimal expert model to perform target detection on the image.
Citation Information
Patent Citations
Visual question and answer implementation method and method based on visual question and answer test model
CN115221369A
Object detection method and device, equipment and storage medium
CN116630916A
System and method for visual and language representation learning
CN117501259A
Automatic driving control method and device, equipment and medium
CN117519134A
Multi-modal model training method and device
CN117541894A
Cited By
Knowledge distillation-based missing multi-modal data dynamic fusion method, system and device
CN118916842A
Multi-expert voting type crowd counting method based on scene understanding
CN119274144A
Target identification method, device and system, electronic equipment and storage medium
CN119313880A
Target recognition method, device, system, electronic device and storage medium
CN119313880B
Multi-modal named entity identification method and device
CN119337883A
