# Cross-Domain Person Re-Identification Based on Feature Fusion Invariance
## 2 Materials and Methods
### Integration Features
#### 2.2.2 Local Feature  
Employing local features aims to capture detailed information from key human body parts, compensating for the limitations of global features under varying poses, occlusions, or appearance changes. Focusing on distinct regions, such as the head, torso, and legs, local features enhance recognition accuracy in complex scenarios, thereby achieving more robust pedestrian matching capabilities. In this paper, local person feature extraction is based on the PCB model [6], and the person image is uniformly divided into six regions from top to bottom, as shown in Figure 2a. Considering the internal features of each person part, a linear classification softmax function is used as the person part classifier. After this classification, the classification of the parts belonging to each feature block can be obtained, and the effect is shown in Figure 2b. To align person widget regions for two images that dynamically match localities from top to bottom to find the alignment of local features with minimum total distance, each pair of sample pairs calculates the minimum total distance and then forms a matrix of minimum total distances, which is defined as the shortest path between the two images. Given the local features of two images \(F=f_{1},f_{2},f_{3}\ldots\) and \(G=g_{1},g_{2},g_{3}\ldots\), first, the distance is normalized by element transformation to \([0,1]\) as follows:  
\[d_{i,j}=\exp(\left\|f_{i}-g_{j}\right\|_{2})-1\Big{/}\exp(\left\|f_{i}-g_{j} \right\|_{2})+1 \tag{1}\]  
In the formula, \(d_{i,j}\) is the distance between the \(i\) component of the first person image and the \(j\) component of the second person image. A distance matrix is formed based on these distances, and the local distance between two images is defined as the total distance of the shortest path from \((1,1)\) to \((t,t)\) in the matrix. This distance can be calculated via dynamic programming as follows:  
Figure 1: Model framework of cross-domain person re-identification. During the training process, labeled source data and unlabeled target data are fed forward into a deep re-identification network to obtain the most recent representations. Subsequently, in the source domain, a model that fuses global and local features is trained. Within the target domain, a feature memory module is introduced, which serves to preserve the latest characteristics of the target data and facilitates computation of the invariance learning loss for the unlabeled target data. In the memory, it operates on a key-value pattern, where 1–5 represent labels corresponding to the stored features. \[S_{i,j}= \begin{cases}d_{i,j}&i=1,j=1\\ S_{i-1,j}+d_{i,j}&i\
eq 1,j=1\\ S_{i,j-1}+d_{i,j}&i=1,j\
eq 1\\ \min(S_{i-1,j},S_{i,j-1})+d_{i,j}&i\
eq 1,j\
eq 1\end{cases}  \tag{2}\]  
The division and semantic alignment of the local features of the person components are shown in Figure 2c. After semantic alignment, the local features are obtained, and each local feature is used as a node to construct a complete local graph; additionally, the relationships between parts and within parts are learned. These nodes are connected by local edges and local inner edges. For each node in the graph, we use an attention weight to weight all its neighbors and then aggregate them to obtain these two relationships. At the same time, we use the loss of attention regularization to constrain the attention weight of local edges to accurately describe the relationship between local edges and inject context information into the attention weight of local inner edges to consider structural information. Taking the local feature \(F_{p}\) as the node, a complete local graph \(G=(F,E)\) is constructed, where e is the edge set, including the local intermediate edge connecting the corresponding parts of different person images and the adjacent nodes and the local inner edge connecting the same person image node. There are \(N*P\) incompletely connected nodes in a complete local graph, and each node has several adjacent nodes, which are the connections of two kinds of edges.