Visual language person re-identification network method and system based on dynamic attention
The visual language pedestrian re-identification network through dynamic attention, combined with foreground perception and lightweight ViLT model, solves the problems of background interference and computational consumption of the pedestrian re-identification network, improves the recognition accuracy and efficiency, and achieves a more complete pedestrian Feature representation.
Patent Information
- Application Number
- CN202410874053.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-07-02
AI Technical Summary
Existing pedestrian re-identification networks have problems in background interference, occlusion and computational consumption, and the fusion and interaction of image information and text information are incomplete, resulting in low recognition accuracy and efficiency.
The visual language pedestrian re-identification network method based on dynamic attention is adopted to enhance foreground information through foreground perception processing, use the lightweight ViLT model for image and text interaction, and dynamically assign weights according to global image features and text features to ensure the balance of information interaction and accuracy.
It improves the accuracy and efficiency of pedestrian recognition, reduces computational consumption, enhances the model's focus on useful information, overcomes the effects of background interference and occlusion, and achieves a more complete pedestrian feature representation.
Smart Images

Figure CN118411739B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a visual language pedestrian re-identification network method and system based on dynamic attention. Background Art
[0002] Person re-identification aims to find specific pedestrians in different camera views, which plays a vital role in finding missing persons. However, due to problems such as blurry search images, low pixels, background interference, and pedestrian occlusion, person re-identification remains a challenging task in computer vision. In recent decades, driven by the rapid development of deep learning technology, this field has made significant progress, and how to improve the accuracy of model search has become an important issue in person re-identification.
[0003] At present, pedestrian re-identification networks are mainly divided into two types: CNN-based and Transformer-based. CNN-based networks have achieved good results on multiple datasets, such as Market1501, MSMT17, DukeMTMC, etc. However, CNN-based methods are sensitive to scale and posture, which hinders the accuracy of local feature extraction and pedestrian recognition at different angles and scenes. On the other hand, compared with CNN models, Transformer-based networks can better retain image detail information, allowing the model to focus on the connection between related areas within the image. This feature helps the model extract the discriminative features required for query image matching under different camera perspectives and environmental conditions, which is crucial for pedestrian re-identification that requires fine-grained information.
[0004] In order to further improve the performance of the model, many researchers have experimented with additional auxiliary modules, such as pose guidance and semantic segmentation guidance. However, these methods require additional annotation information or increase the computational cost of the model. In addition, in complex situations such as pedestrians being occluded, the performance of using auxiliary modules will become unsatisfactory.
[0005] The existing pedestrian re-identification networks have the following problems:
[0006] 1. Existing models are seriously affected by background interference. In traditional Transformer-based person re-identification methods, pedestrians can only be accurately identified in some simple situations, but recognition fails when pedestrians are occluded or the background is blurred.
[0007] 2. Existing multimodal person re-identification methods consume a lot of computation. Among the existing studies on person re-identification using multimodal technology, most are based on the CLIP model. CLIP is a large multimodal model that requires a lot of computational resources and takes too much time to calculate.
[0008] 3. Incomplete fusion interaction between image information and text information. Inappropriate interaction between image information and text information may lead to unsatisfactory model prediction results. Inappropriate weighting of image information and text information may cause one modality to dominate the final feature representation, resulting in an incomplete understanding of the model for the input data. Summary of the invention
[0009] In view of the above situation, the main purpose of the present invention is to propose a visual language pedestrian re-identification network method and system based on dynamic attention to solve the above technical problems.
[0010] The present invention proposes a visual language person re-identification network method based on dynamic attention, and the method comprises the following steps:
[0011] Step 1, obtaining foreground features in the original image, segmenting the foreground features, and performing foreground perception processing on the original image using the segmented foreground features to obtain a foreground perception image;
[0012] Step 2: Send the original image and the foreground perception image to an image encoder to obtain global features of the original image and the foreground perception image, and concatenate the global features of the original image and the foreground perception image to obtain global image features;
[0013] Step 3: Input the question text and the original image into the text encoder. The text encoder predicts the answer to the question text based on the original image, and returns the answer to the question text to generate predicted text. The predicted text is then encoded to generate text features.
[0014] Step 4: Calculate the attention weights of the global image features and text features, and dynamically assign weights according to the importance of the global image features and text features to obtain the attention weighted features of the two modalities. Concatenate the attention weighted features of the two modalities with the global image features to obtain integrated features containing appearance and semantic information. Match the integrated features with pedestrian features to achieve pedestrian recognition.
[0015] The present invention also proposes a visual language person re-identification network system based on dynamic attention, wherein the system applies the visual language person re-identification network method based on dynamic attention as described above, and the system comprises:
[0016] Foreground perception processing module, used to:
[0017] Acquire foreground features in the original image, segment the foreground features, and use the segmented foreground features to perform foreground perception processing on the original image to obtain a foreground perception image;
[0018] Image encoding module, used for:
[0019] The original image and the foreground-perceived image are sent to an image encoder to obtain global features of the original image and the foreground-perceived image, and the global features of the original image and the foreground-perceived image are concatenated to obtain global image features;
[0020] Text encoding module for:
[0021] The question text and the original image are input into the text encoder. The text encoder predicts the answer to the question text based on the original image and returns the answer to the question text to generate the predicted text. The predicted text is then encoded to generate text features.
[0022] Attention dynamic adjustment module, used to:
[0023] The attention weights of global image features and text features are calculated, and the weights are dynamically allocated according to the importance of the global image features and text features to obtain the attention weighted features of the two modalities. The attention weighted features of the two modalities and the global image features are concatenated to obtain integrated features containing appearance and semantic information. The integrated features are matched with pedestrian features to achieve pedestrian recognition.
[0024] Compared with the prior art, the present invention has the following beneficial effects:
[0025] 1. The present invention uses the segmented foreground features to perform foreground perception processing on the original image to enhance the foreground information or weaken the background, which will help to better identify pedestrians.
[0026] 2. The present invention adopts the ViLT pre-trained model to generate image text. ViLT is a lightweight multimodal model that can effectively reduce the time complexity of text conversion.
[0027] 3. The present invention dynamically allocates weights according to the importance between global image features and text features, overcomes the problem of weight allocation bias in the interaction between image and text information, and enables the model to correctly focus on useful information.
[0028] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description or learned through embodiments of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1This is a flow chart of the dynamic attention-based visual language person re-identification network method proposed in the present invention;
[0030] Figure 2 The overall framework of the dynamic attention-based visual language person re-identification network method proposed in this invention;
[0031] Figure 3 This is an example diagram of the segmentation result of the present invention;
[0032] Figure 4 This is the architecture diagram of the image-text dynamic attention module of the present invention;
[0033] Figure 5 This is a schematic diagram of the structure of the dynamic attention-based visual language person re-identification network system proposed in the present invention. DETAILED DESCRIPTION
[0034] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0035] These and other aspects of the embodiments of the present invention will be apparent with reference to the following description and accompanying drawings. In these descriptions and accompanying drawings, some specific implementations of the embodiments of the present invention are specifically disclosed to represent some ways of implementing the principles of the embodiments of the present invention, but it should be understood that the scope of the embodiments of the present invention is not limited thereto.
[0036] See also Figure 1 and Figure 2 , this embodiment provides a visual language pedestrian re-identification network method based on dynamic attention, the method comprising the following steps:
[0037] Step 1, obtaining foreground features in the original image, segmenting the foreground features, and performing foreground perception processing on the original image using the segmented foreground features to obtain a foreground perception image;
[0038] Before the image is input into the network, key foreground information needs to be processed. Specifically, the foreground features in the image are segmented, and then the original image is preprocessed using these segmented foreground features. Although deep learning-based segmentation algorithms are powerful, they introduce additional model complexity and computational overhead. In order to overcome these problems and maintain computational efficiency, the present invention selects a classic threshold segmentation algorithm called the maximum inter-class variance method (OTSU). This choice is to strike a balance between computational efficiency and segmentation accuracy. The basic idea is to select a threshold to divide the image pixels into two categories based on the grayscale distribution characteristics of the image: one is pixels less than the threshold (denoted as C1) as the foreground, and the other is pixels greater than or equal to the threshold (denoted as C2) as the background. Calculate the inter-class variance between these two types of pixels. The larger the inter-class variance, the greater the difference between the foreground and the background, and the better the segmentation effect. Therefore, by traversing all possible thresholds, the threshold that maximizes the inter-class variance is found, which is the optimal threshold.
[0039] Between-class variance The expression is as follows:
[0040] ;
[0041] Among them, the ratio of foreground pixels to the entire image is , and its average grayscale is ; The ratio of background pixels to the entire image is , and its average grayscale is The total average grayscale of the image is recorded as .
[0042] When the pedestrian's clothes are dark in color or the background is too dark, the pedestrian will be classified as background. Figure 3 As shown in Figure 2, pedestrians are classified as background parts. Figure 3 (a) in the figure is the incorrect segmentation result of OTSU. Figure 3 (b) in the figure is the correct segmentation result after the threshold is inverted according to the present invention.
[0043] In order to solve this problem, the present invention inverts the segmentation result according to the pixel distribution to perform foreground enhancement. The specific steps are as follows:
[0044] The original image is segmented into a threshold image using the OTSU threshold segmentation method, and the optimal threshold is obtained;
[0045] Define m square regions in the threshold image;
[0046] Calculate the average pixel value of all square areas. If the average pixel value is less than the threshold parameter, invert the corresponding square area to obtain the segmented image. The process relationship is as follows:
[0047] ;
[0048] in, represents the pixels located in the segmented image, represents the average pixel value calculated within the same segmented image, represents the threshold parameter;
[0049] The pixel values of the foreground part in the segmented image in the original image are restored to obtain a foreground-perceived image.
[0050] The present invention starts with foreground segmentation of the original image to extract key foreground information. Subsequently, the extracted foreground information is used to highlight the foreground area in the original image, and finally a foreground-aware image is generated. Both the original image and the newly generated foreground-aware image are rigorously analyzed in the network. By calculating the loss for each input, accurate feature optimization is ensured.
[0051] Step 2: Send the original image and the foreground perception image to an image encoder to obtain global features of the original image and the foreground perception image, and concatenate the global features of the original image and the foreground perception image to obtain global image features;
[0052] In this step, the image encoder uses a Transformer pre-trained model pre-trained on the ImageNet dataset, which is responsible for extracting discriminative and fine-grained features from the input image. It consists of multiple layers of Transformer layers, each of which consists of a self-attention mechanism and a feedforward network. Given an input image ,in Represent the height, width and number of channels of the image respectively. The image encoder converts the image As input, take the image Converted to an input sequence. Subsequently, an additional learnable class marker is added to the input sequence, and the output of the class marker is used as a global feature, and the output of the rest of the sequence is used as a local feature. In the present invention, only global features are used. The present invention concatenates the global features of the original image and the foreground-perceived image to obtain global image features. In order to facilitate the interaction between the feature and the output feature of the text encoder and facilitate subsequent loss calculations, the present invention uses a batch normalization (BN) layer for normalization in the output part of each Transformer layer.
[0053] Step 3: Input the question text and the original image into the text encoder. The text encoder predicts the answer to the question text based on the original image, and returns the answer to the question text to generate predicted text. The predicted text is then encoded to generate text features.
[0054] The text encoder is responsible for processing text input and generating a Corresponding text features. In the present invention, the question text uses a predefined text template T to extract semantic information. The template takes "a [MASK] wearing a pair of [MASK] pants and a pair of [MASK] shoes, and a [MASK] dress." as an example to ensure the consistency and coherence of text feature representation in different image inputs. Specifically, the element to be predicted is specified as [MASK], and the template T and the image are combined. is provided to the text encoder, which instantiates ViLT. ViLT extends the Transformer to take images and text as input, processing information from both modalities simultaneously. With the powerful performance of ViLT, the text encoder The information contained in the [MASK] element is automatically predicted, and the predicted content is returned to the template T to generate a prediction template. Then we predict the template Encoding generates a set of text features that are closely related to the input image, all of which contain the semantic information of the image. The dimensions of the text features are consistent with the global image features, ensuring the compatibility of the network model and facilitating subsequent interactive operations.
[0055] Step 4: Calculate the attention weights of the global image features and text features, and dynamically assign weights according to the importance of the global image features and text features to obtain the attention weighted features of the two modalities. Concatenate the attention weighted features of the two modalities with the global image features to obtain integrated features containing appearance and semantic information. Match the integrated features with pedestrian features to achieve pedestrian recognition.
[0056] like Figure 2 As shown, Figure 2 middle represents a linear layer, represents feature concatenation, represents the dot product. Figure 2 As can be seen in , the features output by the image encoder and the features output by the text encoder are first traversed through the FC layer and the BN layer to generate refined features. These features are then fed into the attention weight controller. The attention weight controller calculates the attention weights of the image and text features and dynamically assigns weights based on the importance of the features. This process allows the model to pay more attention to important features while filtering out noise from other modal features. The attention weight controller receives refined and ,and and The transpose of is calculated to calculate the attention weights of the two features. The whole process is expressed by the following expression:
[0057] ;
[0058] ;
[0059] in, represents the features output by the image encoder, represents the features output by the text encoder, represents the refined global image features, represents the refined text features, represents a linear transformation operation, Represents a batch normalization operation;
[0060] ;
[0061] ;
[0062] in, represents the attention weight from text to image, which represents the correlation between each element in the text feature and each element in the image feature, represents the attention weight from image to text, Represents the dimension of text features, Represents the dimension of image features, express The transpose of express The transpose of and They represent the control factors of the text-to-image and image-to-text attention mechanisms, respectively, which are learnable tensor matrices.
[0063] Attention Weight and The role of is to emphasize one modality feature and suppress another modality feature, dynamically guiding the feature interaction integration process. and Multiply them together to get the attention weighted features of the two modalities and This process shows the attention of the network model to various modal features. Features with larger weights will receive more attention from the network model. These attention-weighted features are then subjected to Dropout regularization to prevent overfitting of the model and enhance its generalization ability. This process is expressed by the following expression:
[0064] ;
[0065] ;
[0066] in, and represents the attention-weighted features of the two modalities, Represents the dot product operation.
[0067] Finally and and Concatenate to form the final integrated feature. This is expressed by the following expression:
[0068] ;
[0069] in, represents the final integrated feature, Represents a feature concatenation operation.
[0070] Figure 4 The architecture diagram of the image-text dynamic attention module for implementing step 4 is shown in FIG. 4 , which consists of two fully connected layers L, two batch normalization layers BN, an attention weight controller (Attention Weight Controller) and a feature interaction integration component.
[0071] In order to ensure the accuracy of subsequent recognition of the present invention, the present invention further optimizes the training part. In executing the above steps 1 to 4, the corresponding training method includes the following training steps:
[0072] Given a training set, the training set includes training samples and the true labels corresponding to the training samples;
[0073] Repeat steps 1 to 4 using training samples to obtain integrated features, and use integrated features and true labels to construct a cross entropy loss function. The expression of the cross entropy loss function is expressed as:
[0074] ;
[0075] in, Represents the total number of samples, including all instances involved in loss calculation. i represents the index of the current sample, ranging from 1 to N. Represents the true label of the i-th sample, which is an integer ranging from 1 to C, where C represents the total number of categories. Indicates categories, represents the true label weight vector of the i-th sample, represents the weight vector of the jth category, represents transpose, is the integrated feature of the i-th sample.
[0076] Select pedestrian images from the training samples as anchor samples, then select different images of the same pedestrian as positive samples, and select different pedestrian images as negative samples;
[0077] Repeat steps 1 to 4 for the anchor sample, positive sample, and negative sample to obtain the corresponding integrated features. Use these three integrated features to construct the triplet loss function. The expression of the triplet loss function is expressed as:
[0078] ;
[0079] in, represents the integrated features of anchor samples, Indicates the positive sample integration feature, Represents the negative sample integration feature, and the triple loss makes the anchor sample integration feature Integration features with the original sample The embedding space is separated, which reduces the integration features of anchor samples and negative samples at the same time. The distance between. is a margin parameter that controls the minimum distance required between positive and negative pairs.
[0080] Construct a foreground loss function based on the difference between the global features generated from the foreground image and the global features output from the original image;
[0081] The cross entropy loss function, the triplet loss function and the foreground perception loss function are added together as the first loss of the foreground perception processing and the picture encoder part. The process relationship is as follows:
[0082] ;
[0083] in, represents the first loss, represents the foreground loss function;
[0084] The cross entropy loss function and the triplet loss function are added as the second loss of the text encoder and the dynamic weight allocation part. The process relationship is as follows:
[0085] ;
[0086] in, Indicates the second loss;
[0087] The model performance is optimized by minimizing the first loss and the second loss.
[0088] Preferably, in order to improve the model's ability to distinguish foreground and background areas in an image, the present invention designs a loss function called foreground perception loss function. The specific steps are as follows:
[0089] Repeat step 2 using the training sample to obtain the original image features, and use the Euclidean distance to calculate the distance between the original image features and the true label. The process relationship is as follows:
[0090] ;
[0091] in, Represents the distance between the original image feature and the corresponding label value, represents the original image features, Represents the image features of the i-th original image;
[0092] Repeat steps 1 to 2 using the training samples to obtain the foreground image features, and use the Euclidean distance to calculate the distance between the foreground image features and the true label. The process relationship is as follows:
[0093] ;
[0094] in, represents the distance between the foreground image feature and the corresponding label value, represents the foreground image features, Represents the image features of the i-th foreground image;
[0095] In order to improve the stability of the model in the initial stage, this paper introduces the concept of consistency difference. The consistency difference is expressed as the mean absolute difference between the global features generated from the foreground image and the global features output from the original image. In the initial stage of training, the consistency difference will be given a larger weight, and as the training progresses, the weight gradually decreases, allowing the model to be optimized in different ways. The expression is as follows:
[0096] ;
[0097] in, represents the mean absolute difference;
[0098] The foreground perception loss function is constructed based on the distance between the foreground image features and the corresponding label values and the distance between the original image features and the corresponding label values. The process relationship is as follows:
[0099] ;
[0100] in, represents the foreground-aware loss function, Represents the weights that control the consistency difference and the calculated distance respectively. The temperature parameter that represents the magnitude of the scaling loss function.
[0101] Please refer to Figure 5This embodiment also provides a visual language person re-identification network system based on dynamic attention, wherein the system applies the visual language person re-identification network method based on dynamic attention as described above, and the system includes:
[0102] Foreground perception processing module, used to:
[0103] Acquire foreground features in the original image, segment the foreground features, and use the segmented foreground features to perform foreground perception processing on the original image to obtain a foreground perception image;
[0104] Image encoding module, used for:
[0105] The original image and the foreground-perceived image are sent to an image encoder to obtain global features of the original image and the foreground-perceived image, and the global features of the original image and the foreground-perceived image are concatenated to obtain global image features;
[0106] Text encoding module for:
[0107] The question text and the original image are input into the text encoder. The text encoder predicts the answer to the question text based on the original image and returns the answer to the question text to generate the predicted text. The predicted text is then encoded to generate text features.
[0108] Attention dynamic adjustment module, used to:
[0109] The attention weights of global image features and text features are calculated, and the weights are dynamically allocated according to the importance of the global image features and text features to obtain the attention weighted features of the two modalities. The attention weighted features of the two modalities and the global image features are concatenated to obtain integrated features containing appearance and semantic information. The integrated features are matched with pedestrian features to achieve pedestrian recognition.
[0110] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0111] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. A dynamic attention-based visual language person re-identification network method, characterized in that: The method comprises the following steps: Step 1, obtaining foreground features in the original image, segmenting the foreground features, and performing foreground perception processing on the original image using the segmented foreground features to obtain a foreground perception image; Step 2: Send the original image and the foreground perception image to an image encoder to obtain global features of the original image and the foreground perception image, and concatenate the global features of the original image and the foreground perception image to obtain global image features; Step 3: Input the question text and the original image into the text encoder. The text encoder predicts the answer to the question text based on the original image, and returns the answer to the question text to generate predicted text. The predicted text is then encoded to generate text features. Step 4: Calculate the attention weights of the global image features and text features, and dynamically assign weights according to the importance of the global image features and text features to obtain the attention weighted features of the two modalities. Concatenate the attention weighted features of the two modalities with the global image features to obtain an integrated feature containing appearance and semantic information. Match the integrated feature with the pedestrian feature to achieve pedestrian recognition. In step 4, the process of calculating the attention weights of global image features and text features has the following relationship: ; ; in, represents the features output by the image encoder, represents the features output by the text encoder, represents the refined global image features, represents the refined text features, represents a linear transformation operation, Represents a batch normalization operation; ; ; in, represents the attention weight from text to image, represents the attention weight from image to text, Represents the dimension of text features, Represents the dimension of image features, express The transpose of express The transpose of and Represent the control factors of text-to-image and image-to-text attention mechanisms respectively; According to the importance of global image features and text features, the weights are dynamically allocated to obtain the attention weighted features of the two modalities. The following relationship exists: ; ; in, and represents the attention-weighted features of the two modalities, Represents the dot product operation; The process of concatenating the attention-weighted features of the two modalities with the global image features to obtain integrated features containing appearance and semantic information has the following relationship: ; in, represents the final integrated feature, Represents a feature concatenation operation.
2. The method for visual language person re-identification network based on dynamic attention according to claim 1 is characterized in that: In step 1, the foreground features in the original image are segmented, and the original image is preprocessed using the segmented foreground features to obtain the preprocessed image. The method specifically includes the following steps: The original image is segmented into a threshold image using the OTSU threshold segmentation method, and the optimal threshold is obtained; Define m square regions in the threshold image; Calculate the average pixel value of all square areas. If the average pixel value is less than the threshold parameter, invert the corresponding square area to obtain the segmented image. The process relationship is as follows: ; in, represents the pixels located in the segmented image, represents the average pixel value calculated within the same segmented image, represents the threshold parameter; The pixel values of the foreground part in the segmented image in the original image are restored to obtain a foreground-perceived image.
3. The method for visual language person re-identification network based on dynamic attention according to claim 2 is characterized in that: In step 2, the image encoder uses a pre-trained Transformer model, which includes several Transformer layers, and the output part of each Transformer layer is provided with a batch normalization layer for normalization.
4. The method for visual language person re-identification network based on dynamic attention according to claim 3 is characterized in that: In step 3, the text encoder adopts the ViLT model.
5. The method for visual language person re-identification network based on dynamic attention according to claim 1, characterized in that: In executing the above steps 1 to 4, the corresponding training method includes the following training steps: Given a training set, the training set includes training samples and the true labels corresponding to the training samples; Repeat steps 1 to 4 using training samples to obtain integrated features, and use integrated features and true labels to construct a cross entropy loss function. The expression of the cross entropy loss function is expressed as: ; in, Represents the total number of samples, including all instances involved in loss calculation. i represents the index of the current sample, ranging from 1 to N. Represents the true label of the i-th sample, which is an integer ranging from 1 to C, where C represents the total number of categories. Indicates categories, represents the true label weight vector of the i-th sample, represents the weight vector of the jth category, represents transpose, is the integrated feature of the i-th sample; Select pedestrian images from the training samples as anchor samples, then select different images of the same pedestrian as positive samples, and select different pedestrian images as negative samples; Repeat steps 1 to 4 for the anchor sample, positive sample, and negative sample to obtain the corresponding integrated features. Use these three integrated features to construct the triplet loss function. The expression of the triplet loss function is expressed as: ; in, represents the integrated features of anchor samples, represents the positive integration feature, represents the negative sample integration feature, represents the boundary parameter; Construct a foreground loss function based on the difference between the global features generated from the foreground image and the global features output from the original image; The cross entropy loss function, the triplet loss function and the foreground perception loss function are added together as the first loss of the foreground perception processing and the picture encoder part. The process relationship is as follows: ; in, represents the first loss, represents the foreground loss function; The cross entropy loss function and the triplet loss function are added as the second loss of the text encoder and the dynamic weight allocation part. The process relationship is as follows: ; in, Indicates the second loss; The model performance is optimized by minimizing the first loss and the second loss.
6. The method for visual language person re-identification network based on dynamic attention according to claim 5 is characterized in that: The method for constructing a foreground loss function based on the difference between the global features generated by the foreground image and the global features output from the original image specifically includes the following steps: Repeat step 2 using the training samples to obtain the original image features, and use the Euclidean distance to calculate the distance between the original image features and the true label. The process relationship is as follows: ; in, Represents the distance between the original image feature and the corresponding label value, represents the original image features, Represents the image features of the i-th original image; Repeat steps 1 to 2 using the training samples to obtain the foreground image features, and use the Euclidean distance to calculate the distance between the foreground image features and the true label. The process relationship is as follows: ; in, represents the distance between the foreground image feature and the corresponding label value, represents the foreground image features, Represents the image features of the i-th foreground image; The foreground perception loss function is constructed based on the distance between the foreground image features and the corresponding label values and the distance between the original image features and the corresponding label values. The process relationship is as follows: ; in, represents the foreground-aware loss function, Represents the weights that control the consistency difference and the calculated distance respectively. The temperature parameter that represents the size of the scaling loss function, It represents the mean absolute difference. The calculation process of the mean absolute difference is as follows: 。 7. A dynamic attention-based visual language person re-identification network system, characterized in that: The system applies the visual language person re-identification network method based on dynamic attention according to any one of claims 1 to 6, and the system comprises: Foreground perception processing module, used to: Acquire foreground features in the original image, segment the foreground features, and use the segmented foreground features to perform foreground perception processing on the original image to obtain a foreground perception image; Image encoding module, used for: The original image and the foreground-perceived image are sent to an image encoder to obtain global features of the original image and the foreground-perceived image, and the global features of the original image and the foreground-perceived image are concatenated to obtain global image features; Text encoding module for: The question text and the original image are input into the text encoder. The text encoder predicts the answer to the question text based on the original image and returns the answer to the question text to generate the predicted text. The predicted text is then encoded to generate text features. Attention dynamic adjustment module, used to: The attention weights of global image features and text features are calculated, and the weights are dynamically allocated according to the importance of the global image features and text features to obtain the attention weighted features of the two modalities. The attention weighted features of the two modalities and the global image features are concatenated to obtain integrated features containing appearance and semantic information. The integrated features are matched with pedestrian features to achieve pedestrian recognition.
Citation Information
Patent Citations
Pedestrian re-identification method and device based on attention guidance and storage medium
CN112906614A
Image text retrieval method based on context perception attention
CN113392254A
Small-stock crowd re-identification method and model training method
CN114581858A
Text image cross-modal pedestrian retrieval method and system based on implicit relation reasoning alignment
CN116383671A
Medical image segmentation method based on multi-level feature extraction and attention mechanism fusion
CN117456183A
