# PVTReID: A Quick Person Reidentification-Based Pyramid Vision Transformer
## 3 Methods
### Basic PVT-Based Network  
PVT [13; 29] is a state-of-the-art image feature extraction method that is widely used for a variety of computer vision tasks. As an asymptotic feature pyramid method, image features are well learned in the performance of PVT while reducing the computation of large image feature maps. We use PVT as a backbone network to construct a powerful feature extraction network by adding representation learning and metric learning branches to enhance feature extraction capability while improving feature extraction speed. We establish a PVT-based basic network for ReID using the general strong methods [23]. Our PVT-based ReID method consists of two main parts: feature extraction and feature utilization. PVT-V2 is chosen as the backbone network for feature extraction. As shown in Figure 1, it is mainly segmented into four parts with the same structure; the extraction process of each part can be expressed as follows:  
\[Input:I_{1}=x,I_{i}=O_{i-1} \tag{1}\] \[F_{i}=PatchEmb_{i}(I_{i})\] (2) \[O_{i}=Encoder(F_{i}) \tag{3}\]  
For a given image \(x\in\mathbb{R}^{H\times W\times C}\) used as input, where \(H\), \(W\), \(C\) respectively represent its height, width, and number of channels, respectively, we split the image into N patches with fixed size using PatchEmbed. Here, \(I_{i}\) represents the input vector of each part of the PVT. The image \(x\) is the first part of the input vector of the PVT backbone network, while the input vectors of the other parts are the output vectors \(O_{i-1}\) computed from the previous part. The input vector \(I_{i}\) is obtained by \(PatchEmbed_{i}\) to obtain the vector \(F_{i}\), and \(F_{i}\) is calculated by \(Encoder\); to obtain the output vector \(O_{i}\) of each part. Repeating the above operations four times constitutes the PVT-based ReID backbone. In Stage 1, a given input image \(x\in\mathbb{R}^{H\times W\times 3}\) is first divided into \(\frac{H\times W}{4^{2}}\) image patches of size \(4\times 4\times 3\), which are input to PatchEmbed and then expanded into a feature sequence \(F_{1}=\frac{H\times W}{4^{2}}\times C_{1}\). The feature sequence is then input to the corresponding Encoder layer, and the final output is a feature map \(O_{1}=\frac{H}{4}\times\frac{W}{4}\times C_{1}\). The subsequent stage takes the feature output of the previous stage as input for the same operation and outputs the respectively feature maps \(F_{2}\), \(F_{3}\), and \(F_{4}\), with a reduction scale of 8, 16, and 32 times with respect to the input image. Figure 1: PVT-based basic framework. The whole model can be divided into two parts, namely, feature extraction and feature utilization. The feature extraction stage can be divided into four stages; each stage has a PatchEmbed and an Encoder composed of multiple Transformer layers. According to the pyramidal structure, the resolution of the output feature maps of the four stages decreases from the front (1/4 the original image size) to the back (1/32 the original image size). The final output feature maps are subjected to representation learning and metric learning, respectively. Inspired by [23], we introduce the BNNeck before the ID Loss. * is applied to the feature using Batch Normalization. Figure 2: PVTReID Framework. Compared to the PVT-based basic framework, PVTReID adds an SIE module in the encoding phase and a local feature branch in the supervised learning phase. Nonvisual information such as camera information is encoded in the SIE. The SIE is added to the image patch embeddings element-by-element and fed into the Encoder. Supervised learning consists of two separate branches; one branch is a common branch that acquires global features, while the other uses the LFC module to compute the distance between local features and global features to obtain the most discrete local features. ReID loss is contributed by both global feature and local features.