A method for pedestrian re-identification based on multi-resolution images in a UAV background
Patent Information
- Application Number
- CN202310403994.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-17
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2043-04-17
AI Technical Summary
[0006]本发明目的是提供一种无人机背景下基于多分辨率图像的行人重识别方法,针对无人机背景下无人机图像中的行人目标重识别任务,为解决一般的行人重识别模型容易受到图像分辨率的影响,倾向于识别分辨率相近的图像,导致行人重识别模型在无人机背景下的准确率明显下降的问题
[0058](1)一种无人机背景下基于多分辨率图像的行人重识别方法,避免传统卷积神经网络方法中卷积和下采样操作导致低分辨率图像细节进一步丢失。
Smart Images

Figure CN116469130B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of aerial image processing technology, and more specifically to a pedestrian re-identification method based on multi-resolution images in the context of unmanned aerial vehicles (UAVs). Background Technology
[0002] With the continuous development and progress of the economy and society, the concept of smart cities has been proposed. Surveillance systems are widely installed in key locations with high population density, such as stations, roads, parks, shopping malls, and residential communities, playing a vital role in maintaining public security. Pedestrians are key targets in images or videos captured by surveillance systems. Accurately identifying, locating, and tracking target pedestrians from massive amounts of surveillance data is of great significance for assisting in case investigation, finding missing persons, and tracking suspects across different scenarios. Therefore, pedestrian re-identification tasks have received increasing attention from researchers in recent years.
[0003] Pedestrian re-identification aims to re-identify pedestrian targets across fields of view in surveillance footage, that is, to match the same pedestrian target in images taken by different cameras. It is one of the important tasks in computer vision. Pedestrian re-identification requires high accuracy. However, because images of the same pedestrian were taken at different times and from different perspectives, there are significant differences between images of the same pedestrian. Features extracted from images of different pedestrians may be more similar than features of the same pedestrian. Therefore, pedestrian re-identification is challenging due to the large differences between images of the same target and the small differences between images of different targets.
[0004] Especially in the context of drones, due to the constantly changing position and shooting angle of the camera, images from drones present challenges compared to fixed cameras, including lower pedestrian target resolution, greater changes in perspective, and motion blur. This results in a significant decrease in pedestrian re-identification accuracy compared to fixed cameras. Improving pedestrian re-identification accuracy in low-resolution and highly variable image scenarios is a key challenge in drone-based pedestrian re-identification.
[0005] Therefore, it is necessary to provide a pedestrian re-identification method based on multi-resolution images in the context of drones to solve the above problems. Summary of the Invention
[0006] The purpose of this invention is to provide a pedestrian re-identification method based on multi-resolution images in the context of drones. This method addresses the problem that general pedestrian re-identification models are easily affected by image resolution and tend to identify images with similar resolutions, leading to a significant decrease in the accuracy of pedestrian re-identification models in the context of drones.
[0007] To achieve the above objectives, this invention provides a pedestrian re-identification method based on multi-resolution images in the context of unmanned aerial vehicles (UAVs), comprising the following steps:
[0008] S1: Establish a pedestrian re-identification dataset and perform image data preprocessing;
[0009] S2: A camera ID encoding mechanism is proposed to encode the image resolution range and the camera ID;
[0010] S3: Build a pedestrian re-identification framework based on transformer;
[0011] S4: Construct a loss function based on metric learning and classification learning;
[0012] S5: Add the constructed loss function and the encoded camera ID to the person re-identification framework of the transformer to obtain the final person re-identification model based on multi-resolution images;
[0013] S6: Input the test image into the constructed pedestrian re-identification framework and use the trained network to predict the result.
[0014] Preferably, in step S1, image data preprocessing is performed on the large-scale pedestrian re-identification dataset Market-1501 and the large-scale UAV pedestrian re-identification dataset PRAI-1581 to obtain dataset one and dataset two, respectively.
[0015] Preferably, in step S2, a camera ID encoding mechanism is proposed, in which the camera number and image resolution are used as additional auxiliary information input to the model.
[0016] Preferably, in step S3,
[0017] (1) For the case where the input in the transformer is a two-dimensional matrix, the three-dimensional image of the input H*W*C is converted into a two-dimensional input of (N,D) to obtain the patch embedding.
[0018] The input image x is segmented using a sliding window mechanism. By setting the window size and the sliding step size, the image is segmented into multiple two-dimensional patches with some overlap. The formula is as follows:
[0019]
[0020] Where x represents the input image and i represents the patch number.
[0021] Transform the input H*W*C 3D image into N*(P) 2 The transformation process of the sequence *C) is shown in the following formula:
[0022] H*W*C~N*(P 2 *C)
[0023] Where N represents the number of patches in the sequence, (P 2 *C) represents the dimension of each patch, P is the size of the patch, C is the number of channels, and "~" represents the dimension transformation process;
[0024] Add a linear mapping layer to compress the dimension of the patch to D, and finally obtain a D-dimensional patch embedding;
[0025] (2) Use position embedding to encode position information so that the model knows the input position information;
[0026] (3) Assign different weights to the input information based on the current query, construct a self-attention module, input the input sequence into the Transformer Encoder to obtain the output sequence, and set the learning positions embeddings. P To embed spatial information from the image, the specific formula for the input to the transformer layer is as follows:
[0027]
[0028] Where z0 represents the input sequence of the transformer. E is the D-dimensional linear projection of image patch numbered N. P For position embeddings, x class Represents a learnable classification embedding token; after the sequence is input into the encoder, it passes through L Transformer Encoder layers, and... The output is used as an image representation to complete the pedestrian re-identification task.
[0029] Preferably, in step S4, a loss function based on metric learning and classification learning is constructed; in step 401, a cross-entropy function is constructed. After the input image completes feature extraction in the network, it passes through a fully connected layer for classification to obtain the confidence score of the image belonging to each class. Then, the confidence score is normalized through a Softmax layer, and finally, the probability of the image belonging to each class and its identity information is output. The probability calculation formula is as follows:
[0030]
[0031] Where i represents the pedestrian category number, W and b represent the weights and biases between the features and the output in the fully connected layer, respectively; x i Indicates the yth i Features of the i-th input image in the class, p iThis represents the probability that the input image belongs to the i-th class. After obtaining the probability that the input image belongs to each class, the Softmax ID loss function is calculated using the following formula:
[0032]
[0033] Where i represents the input image number, y i The label represents the i-th input image, and N represents the total number of input images (N images).
[0034] Step 402: Construct the triplet loss function. For any image a, select a positive sample p and a negative sample n to form a triplet with a. Here, a is called the anchor sample, p is a positive sample belonging to the same pedestrian as the anchor sample a, and n is a negative sample belonging to a different pedestrian than the anchor sample a.
[0035] The specific formula for the loss function of Triplet is as follows:
[0036]
[0037] Where α is the threshold parameter set in this invention, N is the number of images in the training set, and f(*) is the feature vector of the sample calculated by the neural network.
[0038] Step 403: Construct the total loss function of the model using a multi-task learning mechanism. The specific formula for the total loss function of the model is as follows:
[0039] L=LID+λLT
[0040] Where λ is a hyperparameter set in this invention to balance the weights of the two loss functions.
[0041] Preferably, in step S5, the obtained camera ID encoding extra learnable embedding, patch embedding and position embedding are fused together to obtain the merged information encoding, and then added to the person re-identification framework of the transformer.
[0042] Preferably, in step S5, the obtained loss function is added to the person re-identification framework of the transformer as the loss function of the overall model.
[0043] Preferably, in step S6, dataset one and dataset two are selected for training. The trained network is used to predict the results, and the test results are evaluated using two metrics: mAP and Rank-1 accuracy. mAP refers to the average AP value of all categories, representing the average detection accuracy of the model for all categories of samples. Its formula is as follows:
[0044]
[0045] Where k represents the total number of categories, AP i This represents the AP value for the i-th category.
[0046] Preferably, in step S2, step 201 encodes the image resolution by dividing the image resolution into several different threshold ranges, and dividing the resolution intervals according to the distribution ratio of the resolutions; the specific formula is as follows:
[0047]
[0048] Where N S Indicates the number of resolution ranges, D represents the code length, and E... S The encoding vector represents the image resolution. If an image is in the q-th resolution interval, then its resolution embeddings are E. S [q]; Step 202, encode the information of different camera IDs in the dataset, and the specific formula is as follows:
[0049]
[0050] Where N C D represents the number of cameras in the dataset, E represents the length of the encoding, and D represents the length of the encoding. C This represents the encoded vector of the camera ID. If p represents a certain camera ID, then the camera embeddings of the image captured by that camera are E. C [p];
[0051] The two camera embeddings are then fused to obtain the merged camera ID code, using the following formula:
[0052]
[0053] Where E S E represents the number of image resolution ranges. C D represents the number of cameras in the dataset, E represents the length of the encoding, and D represents the length of the encoding. (S,C) The merged camera ID code represents the result of the fusion process;
[0054] Step 203: Embed the fused camera ID encoding into the transformer layer to obtain the final input sequence, the specific formula of which is as follows:
[0055] Z'0=Z0+αE( S,C )
[0056] Where Z0 is the original input sequence, α is the hyperparameter balancing the original input sequence and the camera ID encoding, and E (S,C) The merged camera ID encoding represents the result of the fusion process.
[0057] Therefore, the present invention employs the above-mentioned pedestrian re-identification method based on multi-resolution images in the context of unmanned aerial vehicles, which has the following beneficial effects;
[0058] (1) A pedestrian re-identification method based on multi-resolution images in the context of drones, which avoids the further loss of low-resolution image details caused by convolution and downsampling operations in traditional convolutional neural network methods.
[0059] (2) A pedestrian re-identification method based on multi-resolution images in the context of UAVs, which improves the model's ability to extract discriminative features of pedestrian images.
[0060] (3) A pedestrian re-identification method based on multi-resolution images in the context of UAVs, which improves the robustness of the model to changes in image resolution and camera.
[0061] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0062] Figure 1 This is a flowchart of a pedestrian re-identification method based on multi-resolution images in the context of an unmanned aerial vehicle (UAV) according to the present invention;
[0063] Figure 2 This is the camera ID encoding model used in this invention;
[0064] Figure 3 This is a diagram of the ViT model framework used in this invention;
[0065] Figure 4 This is a schematic diagram of the attention mechanism used in this invention;
[0066] Figure 5 This is a schematic diagram of the pedestrian re-identification model based on multi-resolution images used in this invention; Detailed Implementation
[0067] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.
[0068] Unless otherwise defined, the technical or scientific terms used in this invention shall have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms "first," "second," and similar terms used in this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0069] Example
[0070] In this implementation case, a pedestrian re-identification method based on multi-resolution images in the context of a drone is presented, such as... Figure 1 As shown, a transformer-based person re-identification framework is used to process low-resolution images. The robustness of the model to changes in resolution and camera type is improved by encoding the image resolution and the drone camera ID. This includes the following steps:
[0071] S1: Establish a pedestrian re-identification dataset and perform image data preprocessing;
[0072] S2: A camera ID encoding mechanism is proposed to encode the image resolution range and the camera ID;
[0073] S3: Build a pedestrian re-identification framework based on transformer;
[0074] S4: Construct a loss function based on metric learning and classification learning;
[0075] S5: Add the constructed loss function and the encoded camera ID to the person re-identification framework of the transformer to obtain the final person re-identification model based on multi-resolution images;
[0076] S6: Input the test image into the constructed pedestrian re-identification framework and use the trained network to predict the result.
[0077] In step S1, based on the large-scale pedestrian re-identification dataset Market-1501 and the large-scale UAV pedestrian re-identification dataset PRAI-1581, image data preprocessing is performed on them respectively to obtain dataset one and dataset two.
[0078] To verify the effectiveness of the model in general scenarios, based on the large-scale pedestrian re-identification dataset Market-1501, image enhancement was performed on the training images of the input model by horizontal flipping and normalization, and the size of the input images was normalized to 384*192, resulting in dataset one.
[0079] To verify the effectiveness of the model in the context of drones, based on the large-scale drone pedestrian re-identification dataset PRAI-1581, image enhancement was performed on the training images of the input model by horizontal flipping, random cropping and erasing, and the size of the input images was normalized to 256*128, resulting in dataset two.
[0080] In step S2, a camera ID encoding mechanism is proposed, which uses the camera number and image resolution as additional auxiliary information input to the model.
[0081] like Figure 2 As shown, the proposed camera ID encoding mechanism is similar to the position embeddings used to encode learnable position information embeddings. Its outstanding innovation is to combine the information contained in each resolution range of the image with the information contained in different camera numbers and introduce it into the encoding layer of the network structure. A camera number embedding is set, and the camera ID, the camera number of the shooting camera and the image resolution of the image are encoded. The encoded camera number embeddings, position information embeddings and image patch embeddings are input together into the transformer encoder for learning; the specific steps are as follows.
[0082] Step 201: Encode the image resolution by dividing it into several different threshold ranges. Dividing the resolution ranges according to the distribution ratio of resolution facilitates clear feature judgment of image resolution. The specific formula is as follows:
[0083]
[0084] Where N S Indicates the number of resolution ranges, D represents the code length, and E... S The encoding vector represents the image resolution. If an image is in the q-th resolution interval, then its resolution embeddings are E. S [q].
[0085] Step 202: Encode information for different camera IDs in the dataset. The specific formula is as follows:
[0086]
[0087] Where NC D represents the number of cameras in the dataset, E represents the length of the encoding, and D represents the length of the encoding. C This represents the encoded vector of the camera ID. If p represents a certain camera ID, then the camera embeddings of the image captured by that camera are E. C [p]
[0088] This invention fuses the two camera information embeddings to obtain a merged camera ID code, and the specific formula is as follows:
[0089]
[0090] Where E S E represents the number of image resolution ranges. C D represents the number of cameras in the dataset, E represents the length of the encoding, and D represents the length of the encoding. (S,C) The merged camera ID encoding represents the result of the fusion process.
[0091] Step 203: Embed the fused camera ID encoding into the transformer layer to obtain the final input sequence, the specific formula of which is as follows:
[0092] Z'0=Z0+αE( S,C )
[0093] Where Z0 is the original input sequence, α is the hyperparameter balancing the original input sequence and the camera ID encoding, and E (S,C) The merged camera ID encoding represents the result of the fusion process.
[0094] In step S3, (1) for the case where the input in the transformer is a two-dimensional matrix, the three-dimensional image of the input H*W*C is converted into a two-dimensional input of (N,D) to obtain patch embedding; (2) position embedding is used to encode the position information so that the model knows the position information of the input; (3) different weights are assigned to the input information according to the current query to construct the self-attention module.
[0095] like Figure 3 As shown, the transformer model proposed in this invention is based on the classic transformer model ViT. The ViT model divides the input image into patches of fixed size, and obtains patch embeddings after linear transformation. These are then input into the transformer for feature extraction and downstream tasks. The following sections will describe in detail the steps of building a person re-identification framework based on transformer.
[0096] Step 301: The input image x is segmented. The model uses a sliding window mechanism, which divides the image into multiple two-dimensional patches with certain overlap by setting the window size and the sliding step size. The formula is as follows:
[0097]
[0098] Where x represents the input image and i represents the patch number.
[0099] Transform the input H*W*C 3D image into N*(P) 2 The transformation process of the sequence *C) is shown in the following formula:
[0100] H*W*C~N*(P 2 *C)
[0101] Where N represents the number of patches in the sequence, (P 2 *C) represents the dimension of each patch, P is the size of the patch, C is the number of channels, and "~" represents the dimension transformation process.
[0102] Since the model requires vectors of dimension D, patches also need to be embedded. Specifically, a linear mapping layer is added to compress the patch dimension to D, resulting in a D-dimensional patch embedding.
[0103] Step 302, set a learnable category embedding token x class This is placed before the input of the image patches projection, and its output serves as the feature representation of the image for subsequent pedestrian re-identification tasks.
[0104] Step 303: A learnable one-dimensional positional encoding mechanism, position embedding, is adopted, and the corresponding patch embedding is added before the input transformer encoder.
[0105] Step 304: Construct the Transformer Encoder. First, build a self-attention module. The attention mechanism assigns different weights to the input information based on the current query. Attention involves three concepts: query, key, and value. For a given query vector, the inner product is used to calculate k corresponding key vectors. Softmax normalizes the inner product, resulting in k weights. The output of attention is the weighted average of the value vectors corresponding to the k key vectors. This attention mechanism is called Scaled Dot Product Attention. Figure 4 As shown in (a). If Q, K, and V are all from a sequence (Q = XW) Q K = XW K V = XW V After a linear transformation, it becomes self-attention.
[0106] This invention employs multi-head self-attention (MSA), defining h attention heads, applying h self-attention mechanisms to the input, and finally summing the results and performing a linear transformation to obtain the final result, as shown below. Figure 4 As shown in (b).
[0107] Step 305: Input the input sequence into the Transformer Encoder to obtain the output sequence, and set the learnable positions embeddings. P To embed the spatial information of the image, the specific formula for the input of the transformer layer is as follows:
[0108]
[0109] Where z0 represents the input sequence of the transformer. E is the D-dimensional linear projection of image patch numbered N. P For position embeddings, x class This represents a learnable category embedding token.
[0110] After the sequence input encoder, it passes through L Transformer Encoder layers, and then... The output is used as an image representation to complete the pedestrian re-identification task.
[0111] In step S4, a loss function based on metric learning and classification learning is constructed.
[0112] Step 401: Construct the cross-entropy function.
[0113] Cross-entropy loss is one of the most common loss functions in classification tasks. This invention treats pedestrian identity information as classification labels, and the pedestrian re-identification task can be viewed as a classification problem. After feature extraction of the input image in the network, it passes through a fully connected layer for classification, obtaining the confidence score of the image belonging to each class. Then, a Softmax layer normalizes the confidence scores, finally outputting the probability that the image belongs to each category, i.e., the identity information. The probability calculation formula is as follows:
[0114]
[0115] Where i represents the pedestrian category number, W and b represent the weights and biases between the features and the output in the fully connected layer, respectively; x i Indicates the yth i Features of the i-th input image in the class, p i This represents the probability that the input image belongs to the i-th class. After obtaining the probability that the input image belongs to each class, the calculation formula of the Softmax ID loss function is as follows:
[0116]
[0117] Where i represents the input image number, y i The label represents the i-th input image, and N represents the total number of input images (N images).
[0118] Step 402: Construct the triplet loss function.
[0119] The triplet loss function is one of the most common loss functions in retrieval and ranking tasks. The loss function for ranking tasks focuses on the relationship between samples, which directly affects the feature distribution of the samples.
[0120] The triplet loss constructed in this invention directly incorporates the constraints on the distribution of anchor samples and positive and negative samples into the function design, enabling the network to adaptively map samples to a feature space where the distance between samples of the same class is smaller than the distance between samples of different classes during training.
[0121] Specifically, the input to the network using the triplet loss function is a triplet input network. During training, for any image 'a', a positive sample 'p' and a negative sample 'n' are selected to form a triplet with 'a'. Here, 'a' is called the anchor sample, 'p' is a positive sample belonging to the same pedestrian as the anchor sample 'a', and 'n' is a negative sample belonging to a different pedestrian than the anchor sample 'a'. The triplet loss function formula is as follows:
[0122]
[0123] Where α is the threshold parameter set in this invention, N is the number of images in the training set, and f(*) is the feature vector of the sample calculated by the neural network.
[0124] Step 403: Construct the total loss function of the model using a multi-task learning mechanism.
[0125] This invention uses cross-entropy loss as the loss function for the classification model and triplet loss as the loss function for the metric model. The multi-task learning mechanism optimizes two tasks simultaneously during training, enabling the model to learn more discriminative features. The specific formula for the model's total loss function is as follows:
[0126] L=LID+λLT
[0127] Where λ is a hyperparameter set in this invention to balance the weights of the two loss functions.
[0128] In step S5, the obtained camera ID encoding extra learnable embedding, patch embedding, and position embedding are fused together to obtain the merged information encoding, which is then added to the transformer's person re-identification framework. Specifically, the three embeddings are summed at their corresponding positions and used as the input to the Transformer Encoder in the person re-identification framework.
[0129] like Figure 5 As shown, in step S5, the obtained loss function is added to the transformer's person re-identification framework as the loss function of the overall model.
[0130] In step S6, dataset one and dataset two are selected for training. The trained network is used to predict the results, and the test results are evaluated using two metrics: mAP and Rank-1 accuracy.
[0131] Step 601: Divide the large-scale pedestrian re-identification dataset Market-1501 to obtain the test dataset.
[0132] Step 602: Input the test dataset into the pedestrian re-identification model based on multi-resolution images constructed in this invention.
[0133] Step 603: Calculate mAP and Rank-1 accuracy based on the model output.
[0134] AP refers to the area enclosed by the Precision-Recall curve and the coordinate axis for a specific class, as IoU (Intersection over Union) changes. mAP refers to the average AP value of all classes, representing the average detection accuracy of the model across all classes of the sample. Its formula is as follows:
[0135]
[0136] Where k represents the total number of categories, AP i This represents the AP value for the i-th category.
[0137] The Rank-1 accuracy is calculated as follows: First, calculate the probability of the class label for each input image in the dataset. Then, determine whether the true label is equal to the predicted class label with the highest probability. Finally, calculate the number of times the true label is determined and divide it by the total number of test images. The resulting metric is called the Rank-1 accuracy.
[0138] Step 604: Compare the algorithm performance based on two metrics: mAP and Rank-1 accuracy.
[0139] Using the calculated mAP and Rank-1 accuracy metrics, this invention compares its performance on the large-scale person re-identification dataset Market-1501 with seven other methods. These seven methods are: 1) methods based on global / local features; 2) methods based on semantic features; 3) methods based on viewpoint; 4) methods based on cross-domain information; 5) methods based on GANs; 6) methods based on data augmentation; and 7) methods based on spatiotemporal information. The comparison results are shown in Table 1.
[0140] Table 1 Comparison Results
[0141]
[0142]
[0143] As can be seen from the table, the method proposed in this invention has a significant performance advantage compared to other methods. Among the compared methods, those based on local features require prior segmentation of pedestrian body parts or additional pose detectors; those based on semantic features require keypoint annotation, and most methods construct complex network architectures to achieve good re-identification performance. In contrast, the spatiotemporal pedestrian re-identification method based on path information proposed in this invention uses readily available spatiotemporal information, which is already included in the original dataset and does not require additional annotation. Furthermore, it significantly improves the performance of the pedestrian re-identification model without the need for complex networks.
[0144] Therefore, this invention adopts the above-mentioned pedestrian re-identification method based on multi-resolution images in the context of drones. It employs a multi-task learning mechanism, improves the model's ability to extract discriminative features through classification learning and metric learning, and creates a camera ID encoding mechanism to improve the model's robustness to resolution and camera changes by encoding resolution ranges and camera IDs. Experimental analysis of this invention was conducted on the PRAI-1581 and Market-1501 datasets. Compared with other mainstream models, this invention has superior performance in the context of drones.
[0145] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the technical solutions of the present invention, and these modifications or equivalent substitutions cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.
Claims
1. A method for pedestrian re-identification based on multi-resolution images in the context of unmanned aerial vehicles (UAVs), characterized in that: Includes the following steps: S1: Establish a pedestrian re-identification dataset and perform image data preprocessing; In step S1, based on the large-scale pedestrian re-identification dataset Market-1501 and the large-scale UAV pedestrian re-identification dataset PRAI-1581, image data preprocessing is performed on them respectively to obtain dataset one and dataset two. Image data preprocessing includes: using the large-scale pedestrian re-identification dataset Market-1501 as a base, horizontal flipping and normalization are used to enhance the training images of the input model, and the size of the input images is normalized to 384*192 to obtain dataset one; Based on the drone pedestrian re-identification dataset PRAI-1581, image enhancement was performed on the training images of the input model using horizontal flipping, random cropping, and erasing. The size of the input images was normalized to 256*128, resulting in dataset two. S2: A camera ID encoding mechanism is proposed to encode the image resolution range and the camera ID; In step S2, step 201, the image resolution is encoded by dividing the image resolution into several different threshold ranges, and the resolution intervals are divided according to the distribution ratio of the resolutions; the specific formula is as follows: in Indicates the number of resolution ranges, D represents the code length, and E... S The encoded vector representing the image resolution, where a certain image is at position i. If there are multiple resolution ranges, then their resolution embeddings are: Step 202: Encode information for different camera IDs in the dataset. The specific formula is as follows: in D represents the number of cameras in the dataset, E represents the length of the encoding, and D represents the length of the encoding. C Let p represent the encoded vector of the camera ID, and p represent a specific camera ID. Then, the camera embeddings of the image captured by that camera are: ; The two camera embeddings are then fused to obtain the merged camera ID code, using the following formula: Where E S E represents the number of image resolution ranges. C D represents the number of cameras in the dataset, E represents the length of the encoding, and D represents the length of the encoding. (S,C) The merged camera ID code represents the result of the fusion process; Step 203: Embed the fused camera ID encoding into the transformer layer to obtain the final input sequence, the specific formula of which is as follows: in, It is the original input sequence. It is a hyperparameter that balances the original input sequence and the camera ID encoding, E (S,C) The merged camera ID code represents the result of the fusion process; S3: Build a pedestrian re-identification framework based on transformer; S4: Construct a loss function based on metric learning and classification learning; In step S4, a loss function based on metric learning and classification learning is constructed; in step 401, a cross-entropy function is constructed. After the input image completes feature extraction in the network, it passes through a fully connected layer for classification to obtain the confidence score of the image belonging to each class. Then, the confidence score is normalized through a Softmax layer, and finally, the probability of the image belonging to each class and its identity information is output. The probability calculation formula is as follows: Where i represents the pedestrian category number, and W and b represent the weights and biases between the features and the output in the fully connected layer, respectively; Indicates the first Features of the i-th input image in the class, This represents the probability that the input image belongs to the i-th class. After obtaining the probability that the input image belongs to each class, the Softmax ID loss function is calculated using the following formula: Where i represents the number of the input image, The label represents the i-th input image, and N represents the total number of input images (N images). Step 402: Construct the triplet loss function. For any image 'a', select a positive sample 'p' and a negative sample 'n' to form a triplet with 'a'. Here, 'a' is called the anchor sample, 'p' is a positive sample belonging to the same pedestrian as the anchor sample 'a', and 'n' is a negative sample belonging to a different pedestrian than the anchor sample 'a'. The specific formula for the triplet loss function is as follows: in, This is the threshold parameter that is set, where N is the number of images in the training set. The feature vector of the sample is calculated by the neural network; Step 403: Construct the total loss function of the model using a multi-task learning mechanism. The specific formula for the total loss function of the model is as follows: in These are the hyperparameters set to balance the weights of the two loss functions; S5: Add the constructed loss function and the encoded camera ID to the person re-identification framework of the transformer to obtain the final person re-identification model based on multi-resolution images; S6: Input the test image into the constructed pedestrian re-identification framework and use the trained network to predict the result.
2. The pedestrian re-identification method based on multi-resolution images in the context of an unmanned aerial vehicle (UAV) as described in claim 1, characterized in that: In step S2, a camera ID encoding mechanism is proposed, which uses the camera number and image resolution as additional auxiliary information input to the model.
3. The pedestrian re-identification method based on multi-resolution images in the context of an unmanned aerial vehicle (UAV) as described in claim 1, characterized in that: In step S3, (1) For the case where the input in the transformer is a two-dimensional matrix, the input... 3D image converted The two-dimensional input is used to obtain the patch embedding; For the input image For segmentation, the model employs a sliding window mechanism. By setting the window size and the sliding step size, the image is segmented into multiple two-dimensional patches with a certain degree of overlap. The formula is as follows: Where x represents the input image and i represents the patch number; Input 3D image becomes The transformation process of the sequence is shown in the following formula: ~ Where N represents the number of patches in the sequence. This represents the dimension of each patch, P is the size of the patch, C is the number of channels, and "~" represents the dimension transformation process. Add a linear mapping layer to compress the dimension of the patch to D, and finally obtain a D-dimensional patch embedding; (2) Use position embedding to encode position information so that the model knows the input position information; (3) Assign different weights to the input information according to the current query, construct a self-attention module, input the input sequence into the Transformer Encoder to obtain the output sequence, and set the learning position embeddings. To embed spatial information from the image, the specific formula for the input to the transformer layer is as follows: in This represents the input sequence of the transformer. For the D-dimensional linear projection of image patch number N, For location embeddings, The learning-representing classification embedding token; after the sequence input encoder, it passes through L Transformer Encoder layers, and... The output is used as an image representation to complete the pedestrian re-identification task.
4. The pedestrian re-identification method based on multi-resolution images in the context of an unmanned aerial vehicle (UAV) as described in claim 3, characterized in that: In step S5, the obtained camera ID encoding extra learnable embedding, patch embedding and position embedding are fused together to obtain the merged information encoding, and then added to the person re-identification framework of the transformer.
5. The pedestrian re-identification method based on multi-resolution images in the context of an unmanned aerial vehicle (UAV) as described in claim 1, characterized in that: In step S5, the obtained loss function is added to the transformer's person re-identification framework as the loss function of the overall model.
6. The pedestrian re-identification method based on multi-resolution images in the context of an unmanned aerial vehicle (UAV) as described in claim 1, characterized in that: In step S6, dataset one and dataset two are selected for training. The trained network is used to predict the results, and the test results are evaluated using two metrics: mAP and Rank-1 accuracy. mAP refers to the average AP value of all categories, representing the average detection accuracy of the model for all categories of samples. Its formula is as follows: Where k represents the total number of categories, This represents the AP value for the i-th category.
Citation Information
Patent Citations
Multi-resolution collaborative pedestrian identification method and related equipment
CN114120200A