A pedestrian re-identification method based on a random feature interaction module optimized by a genetic algorithm
By introducing a random feature interaction module optimized by a genetic algorithm into the pedestrian re-identification model, the problem of feature matching failure in occluded scenarios is solved, achieving more efficient pedestrian re-identification performance and robustness.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHAANXI UNIV OF SCI & TECH
- Filing Date
- 2026-02-10
- Publication Date
- 2026-07-31
AI Technical Summary
Existing pedestrian re-identification technologies suffer from performance degradation in occluded scenarios. Traditional methods are prone to getting stuck in local optima and overfitting, and are difficult to adapt to the randomness of occlusion location and scale, leading to feature matching failure.
A random feature interaction module (RFIM) based on genetic algorithm optimization is adopted. By constructing a heterogeneous dual-branch structure at the end of the Transformer, combining global and local features, and using gradient-free random search to dynamically optimize feature grouping, dynamic adjustment and optimization of features are achieved.
It overcomes the limitations of static partitioning, improves pedestrian re-identification performance in occluded scenarios, enhances the robustness and generalization ability of the model, reduces noise interference, and strengthens the discriminative power of features.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer vision, specifically relating to a pedestrian re-identification method based on a random feature interaction module of a genetic algorithm. Background Technology
[0002] Person re-identification (ReID), as a core technology for cross-camera target retrieval, has significant application value in fields such as intelligent security and smart cities. This technology aims to identify the same pedestrian from non-overlapping images or videos captured by different cameras. In recent years, with the development of deep learning, person re-identification methods have evolved from hand-designed features to deep convolutional networks, and then to the Transformer architecture. However, occlusion remains a key bottleneck restricting the improvement of algorithm performance. Real-world testing data shows that the accuracy of person re-identification drops significantly in heavily occluded scenarios, mainly due to problems such as missing local information, feature misalignment, and noise interference caused by occlusion.
[0003] Early research primarily relied on convolutional neural networks (CNNs) to address occlusion challenges by constructing local feature extraction modules. Representative approaches include: part-aware models, which locate body regions through predefined horizontal blocks or pose keypoints and explicitly extract local features, such as the HOReID network which uses higher-order relationships to model the topological structure between parts, and CDNet which integrates deep spatial information to optimize feature selection; and semantically guided parsing schemes, such as the ISP method, which enhances the fine-grained understanding of pedestrian parts by combining semantic segmentation tasks. However, these methods have fundamental drawbacks: their part segmentation relies on static rules (such as uniform block division or predefined templates), making it difficult to adapt to the randomness of occlusion location, scale, and shape; and when occlusion disrupts the predefined region, local feature extraction introduces strong noise interference, leading to feature matching failure.
[0004] With the rise of Visual Transformers (ViT), self-attention-based models have gradually become mainstream. These methods significantly improve robustness to pose changes through global context modeling capabilities. For example, the pure Transformer model TransReID introduces a jigsaw puzzle module (JPM) to enhance local feature diversity and embeds information from camera perspectives to optimize the matching process. Hybrid architectures are also being explored; recent research, such as the SPH network, combines CNN and Transformer branches to handle semantic perception and pose information respectively. PoseAlign, on the other hand, uses Spatial Alignment Blocks (SABs) to fuse multi-scale features, alleviating the problem of missing global information in traditional CNNs. Despite these advancements, Transformers still exhibit significant drawbacks in occluded scenarios, such as positional encoding loss. In deep networks, positional information gradually decays, leading to distortion in spatial relationship modeling. For instance, when a pedestrian's arm is occluded, adjacent background regions may be incorrectly associated. Traditional self-attention mechanisms focus only on feature associations within samples, neglecting cross-sample similarity comparisons, making it difficult to form discriminative clusters in the feature space. Features in occluded regions cannot be effectively suppressed, becoming sources of interference in attention weight allocation and amplifying local noise.
[0005] To improve occlusion robustness, numerous studies have attempted to incorporate prior human knowledge to assist feature localization. For example, the Attentional Pose Network developed by the Shenzhen University team utilizes mask image encoding technology to enhance feature recovery capabilities for occluded areas. The occlusion-aware 6D pose estimation framework proposed by Shanxi University dynamically constructs a graph topology structure of sparse keypoints (such as bounding box corners) using depth maps and enhances geometric relationship modeling through cross-semantic fusion, achieving occlusion-robust 6D pose estimation. While these methods can improve part localization accuracy, they have the following limitations: 1) They rely on high-precision pose estimators or parsers, and the performance of these auxiliary models significantly degrades in occluded scenarios; 2) They introduce additional computational load, making it difficult to meet real-time retrieval requirements; 3) They have weak generalization ability across datasets, with performance plummeting when the test data distribution deviates from the training data. Another mainstream approach is to synthesize or complete occluded region features. For example, the SPH network employs a "human completion strategy," using image library samples to complete missing parts of the query image; there are also methods that generate reasonable features for occluded regions through adversarial training. However, these methods face the challenge of feature authenticity: the generated features may conflict with actual identity information, especially when there is severe occlusion, which can easily lead to identity shifts. Robustness can be improved by exploring multi-source information fusion, but this requires complex hardware support (such as multi-camera synchronization), making it difficult to adapt to universal monitoring scenarios. Moreover, multimodal alignment errors can further amplify pose estimation bias. For example, the team at Zhejiang University of Technology used distributed visual sensor information to estimate the coordinates of occluded parts using an unscented Kalman filter; and based on temporal modeling of video sequences, they compensated for the lack of information in single frames to perform spatiotemporal feature aggregation.
[0006] Current feature optimization methods mostly rely on the gradient descent framework, which has two major bottlenecks: First, they are prone to getting trapped in local optima. End-to-end training of CNN / Transformer can easily cause the model to converge to local optima, making it difficult to break through the constraints of the initial architecture. Second, there is the risk of overfitting. Complex networks can overfit noisy patterns when the number of occluded samples is limited.
[0007] To address the aforementioned challenges, this patent proposes a pedestrian re-identification method based on a random feature interaction module optimized by a genetic algorithm. Its core breakthrough lies in abandoning the traditional static component partitioning paradigm and introducing the principle of a genetic algorithm to achieve dynamic evolution of feature grouping. RFIM, as a heterogeneous branch at the end of the Transformer, works collaboratively with the global feature branch, using a gradient-free optimization mechanism to solve the local dominance problem caused by occlusion. Summary of the Invention
[0008] To overcome the shortcomings of the prior art, the purpose of this invention is to provide a pedestrian re-identification method based on a random feature interaction module optimized by a genetic algorithm. By deploying a dual-branch structure at the end of the Transformer, global and local features are extracted, and the depth prediction results are gradually optimized by performing gradient-free random search on the local feature group.
[0009] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0010] A pedestrian re-identification method based on a random feature interaction module optimized by a genetic algorithm includes the following steps:
[0011] Step 1: Feature extraction;
[0012] In the feature extraction section, the input image is first processed through a convolutional layer (similar to the linear projection in ViT, but capable of learning stronger initial representations), transforming the local region of each patch of size [P,P] into a flattened one-dimensional embedding vector. These embeddings are then dimensionally adjusted to form a tensor of shape [B,N,D], where B represents the batch size (the number of images processed at once), N is the number of calculated patches, and D is the embedding dimension (the length of the feature vector for each patch). To clarify the spatial structure information of the model, a set of parameters is used as the positional embedding, with a length consistent with the input sequence (containing N+1 elements: N patch patches + 1 class label [CLS]), and D is the embedding dimension after convolutional transformation. Through simple element-wise addition, positional information is directly superimposed onto the corresponding semantic embeddings, enabling the model to distinguish patches at different spatial locations. The model adds a class label [CLS] at the beginning of the sequence composed of all patch embeddings; this special label aims to aggregate global information from the entire image. This embedding sequence is then fed into the Transformer encoder.
[0013] Step 2: Feature learning;
[0014] The core of feature learning is handled by an L-layer standard Transformer encoder. Each layer contains a Multi-Head Self-Attention (MHSA) and Feed-Forward Network (FFN) module, and applies layer normalization and residual connections. Thanks to the self-attention mechanism, each Transformer layer has a global receptive field, allowing any element in the sequence to directly attend to and fuse information from all other elements in the sequence, thereby modeling long-distance dependencies. From the initial convolutional layer to all L-layer Transformers, the spatial resolution of the feature maps (reflected in the block sequence length N+1) and the embedding dimension D remain unchanged. This design preserves the low-level details and spatial information of the image to the greatest extent, which is crucial for distinguishing different individuals with similar appearances but subtle differences (such as accessories and textures) in person re-identification tasks, as well as handling challenges such as occlusion and pose changes. The model finally uses the output vector corresponding to the [CLS] label as a global feature representation of the entire input image.
[0015] Step 3: Extraction of dual-branch features;
[0016] Innovatively, a heterogeneous dual-branch structure is constructed at the end of the Transformer. The global feature extraction branch processes the hidden features of the last layer through the standard Transformer encoder, outputting a global feature vector representing the overall image semantics. Then, the Random Feature Interaction (RFIM) branch extracts local features, dividing all features into... Sub-features, represented as At the same time, each group shares the same learnable category label. This enables parameter reuse. The data is then processed by a Transformer layer to generate fine-grained local features. The hidden features input to the last layer are defined as follows: .
[0017] Step 4: RFIM dynamic feature optimization;
[0018] First, the feature matrix is initialized. Based on the output of the (L-1)th layer Transformer, a list containing N+1 elements is constructed, consisting of N sub-blocks obtained from the segmentation and a category label. This represents the initial state of the matrix list. This represents the feature sequence of the i-th sub-block. Then, a new list of matrices is generated by expanding the original list. Each element of the new list is defined by a characteristic. Random number of moves and number of random groups Generate recombination features and randomly move steps. Sample random integers from a discrete uniform distribution ranging from 0 to the maximum number of steps, and randomly group the samples into groups. It refers to the number of subsets into which features are divided in the feature space. Controlling the granularity of subspace division enables feature recombination and reduces overfitting. Defined as The number of random movement steps pass Implement feature cyclic shifting; random grouping number The feature index set is divided into Each set of features is aggregated by summing each item. , The new j value is obtained after cyclic shifting. Then, a category label is added to the beginning of each feature group for parallel transmission to the next step. In summary, the feature recombination method varies with each module call, allowing for better dynamic adjustment of feature combinations based on the relationships between features.
[0019] Next, a flexible grouping strategy is adopted, and selection is made based on fitness. The fitness function of the t-th feature is... The formula for calculation is:
[0020] (1)
[0021] in, It is a fixed value C (C=1) minus the sum of the normalized classification loss and the triplet loss from the previous forward propagation. The cross-entropy loss function is used to calculate the difference between the model's output class prediction and the true class. This indicates the use of the triplet loss function. By calculating the distance between the anchor image and the positive sample image, and the distance between the anchor image and the negative sample image, a triplet loss is constructed, enabling the model to learn more discriminative features. Next, the selection probability of each feature combination is calculated. The calculation formula is:
[0022] (2)
[0023] pass Selection is based on both fitness and a probability-based selection mechanism; feature combinations with high fitness are retained, while those with low fitness are eliminated. The fitness of the resulting feature combinations is then used to determine the optimal fitness level. Calculate the probability of selection The higher the fitness of a feature combination, the greater its probability of being selected. Selection operation:
[0024] (3)
[0025] Building upon this, mutation and crossover operations were introduced to further optimize feature combinations. The purpose of crossover is to generate new offspring individuals by combining partial features from two parent individuals. In this process, two index values, i and j, are first randomly selected to determine the scope of the crossover. Then, features are copied from the parent individuals to the offspring individuals. This method can more effectively capture the interactions between features. Represented as:
[0026] (4)
[0027] in, This represents the feature resulting from the intersection of the i-th and j-th features.
[0028] Then, a mutation operation is performed, randomly replacing elements in the feature matrix to further optimize the feature combination, resulting in a mutated sub-element matrix. This avoids getting trapped in local optima, reduces the risk of overfitting, and thus improves the model's generalization ability. Mutation operation Represented as:
[0029] (5)
[0030] Where G represents the characteristic matrix after Gaussian transformation, and This is the index specified in the feature matrix, indicating the feature range to be mutated. Next, a random Gaussian value k is generated and replaced with this value at the index. The corresponding feature location. Here, It is in and The randomly selected index indicates the target location of the mutated feature. In this way, and between The feature value at a given location is replaced with a new Gaussian value k, thereby achieving feature mutation. This helps the model explore a wider feature space during training, thus improving the model's performance. Indicates to and The characteristics resulting from the variations between them.
[0031] By progressively optimizing feature combinations through the aforementioned selection, mutation, and crossover operations, the search space can be adaptively explored. Subsequently, the features are concatenated, allowing local features to cover different parts of the pedestrian, including portions obscured by vehicles or other obstacles, ultimately yielding locally optimal features. , and To specify the percentage of mutation or crossover at random, the operation is as follows:
[0032] (6)
[0033] Then based on the obtained Encode local features as Calculate the local loss using a combination of features. Then use fitness To evaluate the quality of the reconstructed image, see Equation (1).
[0034] Step 5: Loss Function and Joint Training;
[0035] Based on the optimized features, the local features are encoded at this stage. 1 independent local feature vector Through the triplet loss function Calculate the distance between the anchor image and the positive sample image (of the same class) and the distance between the anchor image and the negative sample image (of different classes), and use the cross-entropy loss function. The difference between the predicted class output by the calculation model and the true class is used to enable the model to learn more discriminative features. Simultaneously, the fitness function defined in Equation (8) is used to evaluate the quality of feature reconstruction, driving the model to suppress noise interference. Then, the global features are... With local features By splicing along the channel dimension, a final joint representation is formed. By following the steps above, dynamic feature recombination can be performed based on the relationships between features, thereby forming an innovative feature processing flow that effectively improves pedestrian re-identification performance.
[0036] The beneficial effects of this invention are:
[0037] 1. Dynamic Feature Grouping Mechanism: Overcoming the Limitations of Static Division. Existing pedestrian re-identification methods (such as HOReID, PAT, etc.) generally adopt fixed block strategies (horizontal stripe division or pose key point localization), and their grouping rules are fixed after training, which cannot adapt to the randomness of occlusion position / scale. When the predefined region is destroyed (such as a handbag occluding the lower body), traditional models are forced to rely on noisy features. The RFIM module proposed in this patent innovatively introduces a dynamic grouping mechanism driven by a genetic algorithm. Through selection-mutation-crossover operations, the grouping strategy is dynamically adjusted to adaptively aggregate effective feature regions in occluded scenarios.
[0038] 2. Gradient-Free Optimization Architecture: Solving the Local Optimality Trap. Traditional Transformers rely on gradient descent optimization, which is prone to getting trapped in local optima in occluded scenarios. The RFIM module pioneers a gradient-free random search paradigm, using selection-mutation-crossover operations to allow the model to break free from the limitations of the initial architecture, integrate cross-sample features to generate offspring, and reconstruct the semantics of occluded regions.
[0039] 3. Occlusion Generalization Ability: Robust Feature Reconstruction Across Scenes. Under extreme occlusion challenges, the performance of existing technologies deteriorates sharply. RFIM overcomes the problem of local noise amplification through a bidirectional anti-interference mechanism, and improves the performance of pedestrian re-identification models by fusing cross-viewpoint features through cross-operations. Attached Figure Description
[0040] Figure 1 This is a flowchart of the method of the present invention;
[0041] Figure 2 This is a network architecture diagram of the present invention;
[0042] Figure 3 This is an architecture diagram of the RFIM module of the present invention;
[0043] Figure 4 These are the experimental results of this invention on the Market1501, MSMT17, DukeMTMC-reID, and Occluded-Duke datasets. Detailed Implementation
[0044] The present invention will be further described below with reference to embodiments and accompanying drawings.
[0045] A pedestrian re-identification method based on a random feature interaction module optimized by a genetic algorithm includes the following steps:
[0046] First, feature extraction is performed, segmenting the input pedestrian image into N patches. These patches are then processed by a convolutional layer, converting the local region of each patch (size [P, P]) into a flattened one-dimensional embedding vector. This vector is then fed into a Transformer encoding layer, where a global branch (preserving overall features) and an RFIM branch (extracting anti-occlusion local features) are deployed in parallel at the Transformer's end. The patch features and class labels are encoded into a feature matrix list containing N+1 elements (N patch features + 1 class label). A genetic algorithm is used to dynamically optimize the feature grouping through selection, mutation, and crossover operations, overcoming the local optima limitation of traditional gradient descent and achieving gradient-free random search. Finally, the optimized features are concatenated to generate local optimal features covering all parts of the pedestrian (including occluded parts), and encoded as... Each feature is a local feature. Finally, the model combines the global and local features to form the final representation for inference and fitness evaluation. The loss function is a weighted sum of the global and local losses, calculated using cross-entropy loss and triplet loss respectively, jointly driving the model to learn more discriminative feature representations.
[0047] Figure 1 The specific flowchart of this method can be divided into five steps:
[0048] Step 1: Feature extraction;
[0049] To achieve the above objectives, we designed a complete pedestrian re-identification network. Figure 2 This is a complete network framework diagram.
[0050] In the feature extraction section, the input image undergoes feature projection through a convolutional layer. The convolutional kernel performs non-linear mapping of local regions, significantly enhancing the initial features. Each patch of size [P, P] is converted into a one-dimensional embedding vector of dimension D, where the embedding dimension is strictly defined by the formula D = P²·C, and C is the number of input channels. After dimension reconstruction, a normalized three-dimensional tensor [B, N, D] is formed, where B is the batch size (the number of images processed in a single batch), N is the number of patches calculated from the image size and stride S, and D is the embedding dimension. The formula for calculating N is:
[0051] (1)
[0052] The patch sequence is as follows:
[0053] (2)
[0054] (3)
[0055] (4)
[0056] in, , , These represent the values in row a and column b of the red, green, and blue channels, respectively, with subscripts... , , These are the corresponding items. , , These represent the i-th terms of the red, green, and blue channels in the RGB channels, respectively. Let a and b be natural numbers, and F be a linear projection that maps the patch to D dimensions. , , These are the i-th items in the red, green, and blue channels, respectively;
[0057] The flattened one-dimensional vector sequence is as follows:
[0058] (5)
[0059] To clarify the spatial structure information of the model, a set of parameters was used as the location embedding, with a length consistent with the input sequence (containing N+1 elements: N blocks + 1 class label [CLS]), and a dimension of D. Through simple element-wise addition, the location information is directly superimposed onto the corresponding semantic embedding, enabling the model to distinguish blocks at different spatial locations. A class label is added before each patch, and the spatial relationship between patches is identified by accumulating the location embedding vectors. The patch sequence blocks segmented from the image are then input into the Transformer encoder, and the sequence is represented as follows:
[0060] (6)
[0061] in Indicates the input sequence embedding. Indicates category label, This represents the i-th linear projection at position p. This indicates positional embedding.
[0062] Step 2: Feature Learning
[0063] The core of feature learning is handled by an L-layer standard Transformer encoder. Each layer contains a Multi-Head Self-Attention (MHSA) and Feed-Forward Network (FFN) module, and applies Layer Normalization and Residual Connections. Thanks to the self-attention mechanism, each Transformer layer possesses a Global Receptive Field, allowing any element in the sequence to directly attend to and fuse information from all other elements in the sequence, thereby modeling long-range dependencies. Furthermore, no downsampling operation is performed throughout the feature extraction process. From the initial convolutional layer to all L-layer Transformers, the spatial resolution of the feature map (reflected in the block sequence length N+1) and the embedding dimension D remain unchanged. This design maximizes the preservation of low-level details and spatial information of the image, which is crucial for distinguishing different individuals with similar appearances but subtle differences (such as accessories and textures) in person re-identification tasks, as well as handling challenges such as occlusion and pose variations. The model ultimately uses the output vector corresponding to the class label as the global feature representation of the entire input image.
[0064] Step 3: Two-branch feature extraction
[0065] At the end of the Transformer, a global branch (preserving overall features) and an RFIM branch (extracting anti-occlusion local features) are deployed in parallel. This design adds an RFIM branch, defining the hidden features input to the last layer as denoted as... Global branches are... The encoded standard Transformer output is used as global features. The RFIM branch will... Divided into Groups, each group shares the [CLS] embedding. Then, the group features are input into the Transformer layer to learn. A local feature, denoted as .
[0066] Step 4: RFIM Dynamic Feature Optimization
[0067] First, the feature matrix is initialized. Based on the output of the (L-1)th layer Transformer, a list containing N+1 elements is constructed, which consists of N sub-blocks obtained from the segmentation and a category label. This represents the initial state of the matrix list. This represents the feature sequence of the i-th sub-block. Then, a new list of matrices is generated by expanding the original list. Each element of the new list is defined by a characteristic. Random number of moves and number of random groups Generate recombination features and randomly move steps. Sample random integers from a discrete uniform distribution ranging from 0 to the maximum number of steps, and randomly group the samples into groups. This refers to the number of subsets into which features are divided in the feature space. Controlling the granularity of subspace partitioning allows for feature recombination and reduces overfitting. Each item... Defined as The number of random movement steps pass Implement feature cyclic shifting; random grouping number The feature index set is divided into Each set of features is aggregated by summing each item. , The new j value is obtained after cyclic shifting. Then, a category label is added to the beginning of each feature group for parallel transmission to the next step. In summary, the feature recombination method varies with each module call, allowing for better dynamic adjustment of feature combinations based on the relationships between features.
[0068] Next, a flexible grouping strategy is adopted, and selection is made based on fitness. The fitness function of the t-th feature is... The formula for calculation is:
[0069] (1)
[0070] in, It is a fixed value C (C=1) minus the sum of the normalized classification loss and the triplet loss from the previous forward propagation. The cross-entropy loss function is used to calculate the difference between the model's output class prediction and the true class. This indicates the use of the triplet loss function. By calculating the distance between the anchor image and the positive sample image, and the distance between the anchor image and the negative sample image, a triplet loss is constructed, enabling the model to learn more discriminative features. Next, the selection probability of each feature combination is calculated. The calculation formula is:
[0071] (2)
[0072] pass Selection is based on both fitness and a probability-based selection mechanism; feature combinations with high fitness are retained, while those with low fitness are eliminated. The fitness of the resulting feature combinations is then used to determine the optimal fitness level. Calculate the probability of selection The higher the fitness of a feature combination, the greater its probability of being selected. Selection operation:
[0073] (3)
[0074] Building upon this, mutation and crossover operations were introduced to further optimize feature combinations. The purpose of crossover is to generate new offspring individuals by combining partial features from two parent individuals. In this process, two index values, i and j, are first randomly selected to determine the scope of the crossover. Then, features are copied from the parent individuals to the offspring individuals. This method can more effectively capture the interactions between features. Represented as:
[0075] (4)
[0076] in, This represents the feature resulting from the intersection of the i-th and j-th features.
[0077] Then, a mutation operation is performed, randomly replacing elements in the feature matrix to further optimize the feature combination, resulting in a mutated sub-element matrix. This avoids getting trapped in local optima, reduces the risk of overfitting, and thus improves the model's generalization ability. Mutation operation Represented as:
[0078] (5)
[0079] Where G represents the characteristic matrix after Gaussian transformation, and This is the index specified in the feature matrix, indicating the feature range to be mutated. Next, a random Gaussian value k is generated and replaced with this value at the index. The corresponding feature location. Here, It is in and The randomly selected index indicates the target location of the mutated feature. In this way, and between The feature value at a given location is replaced with a new Gaussian value k, thereby achieving feature mutation. This helps the model explore a wider feature space during training, thus improving the model's performance. Indicates to and The characteristics resulting from the variations between them.
[0080] By progressively optimizing feature combinations through the aforementioned selection, mutation, and crossover operations, the search space can be adaptively explored. Subsequently, the features are concatenated, allowing local features to cover different parts of the pedestrian, including portions obscured by vehicles or other obstacles, ultimately yielding locally optimal features. , and To specify the percentage of mutation or crossover at random, the operation is as follows:
[0081] (6)
[0082] Then based on the obtained Encode local features as Calculate the local loss using a combination of features. Then use fitness To evaluate the quality of the reconstructed image, see Equation (8).
[0083] Step 5: Loss Function and Joint Training;
[0084] Based on the optimized features, the local features are encoded at this stage. 1 independent local feature vector Through the triplet loss function Calculate the distance between the anchor image and the positive sample image (of the same class) and the distance between the anchor image and the negative sample image (of different classes), and use the cross-entropy loss function. The difference between the class prediction output by the calculation model and the true class is used to enable the model to learn more discriminative features. Simultaneously, the fitness function defined in equation (1) is used to evaluate the quality of feature reconstruction, driving the model to suppress noise interference. Then, the global features are... With local features By splicing along the channel dimension, a final joint representation is formed. By following the steps above, dynamic feature recombination can be performed based on the relationships between features, thereby forming an innovative feature processing flow that effectively improves pedestrian re-identification performance.
[0085] The invention will be further described below with reference to simulation examples.
[0086] Simulation example:
[0087] This study implemented a Transformer person re-identification system integrating the RFIM module on an NVIDIA TITAN V GPU hardware platform and PyTorch 2.0 framework. The model uses ViT-Base as the backbone network, loads ImageNet pre-trained weights, and deploys a dual-branch structure in the last layer of the Transformer: the global branch retains the standard encoder design, while the RFIM branch introduces a genetic algorithm optimization mechanism. The training parameters are configured as follows: input image is 256×128 pixels, SGD optimizer is used with a base learning rate of 0.008, weight decay coefficient of 0.0001, bias term weight decay of 0.0001, bias learning rate multiplication factor of 2, and cosine function is used for learning rate decay. Data augmentation strategies include random horizontal flipping, random erasure, and edge padding.
[0088] To verify the effectiveness of this invention, we selected four representative public pedestrian re-identification datasets for testing: Market-1501, DukeMTMC-reID, MSMT17, and Occluded-Duke (15,618 training images), which is specifically designed for occluded scenes. Occluded-Duke differs from the other datasets in that its images are selected from DukeMTMC-reID, with the training set, query set, and gallery set containing 9%, 100%, and 10% of occluded images, respectively. It is a key dataset for verifying the robustness of the RFIM module. During the training phase, a batch size of 64 was used, and optimization was performed for 360 epochs, employing a momentum of 0.9 and a weight decay rate of 1e-4.
[0089] The core innovation of the RFIM module lies in its feature chromosome initialization and genetic operation process: based on the output of the (L-1)th layer of the Transformer, a feature matrix containing N+1 elements (N patch features + 1 class label) is constructed. Each element consists of a feature vector and the number of random moves. and initial number of groups Forming triples. In the feature optimization process, the fitness function is first defined. The quality of feature combinations is quantified by retaining high-fitness combinations through a selection operation. A crossover operation is then performed, randomly selecting two index values i and j to determine the crossover range. Features are then copied from parent individuals to child individuals; this method more effectively captures the interactions between features. A mutation operation is then performed, randomly replacing elements in the feature matrix to further optimize feature combinations. Child elements are generated by combining partial features from two parent elements, and the interactions between features are captured more evenly through shifting, resulting in a mutated child element matrix to avoid getting trapped in local optima and reduce the risk of overfitting. After multiple iterations of optimization, the resulting matrix is concatenated to generate... Local features Ultimately, it relates to global features. Weighted fusion is performed, and the total loss function is: ,in For cross-entropy loss, This is the loss of the triplet.
[0090] To comprehensively evaluate the performance of RFIM, this study designed a multi-dimensional validation scheme: in terms of performance evaluation, the mAP and Rank-1, Rank-5, and Rank-10 indices of the baseline ViT model and the ViT+RFIM model were compared on four datasets. The ablation experiment results are as follows: Figure 4 As shown in the figure. Experimental results demonstrate that the RFIM module exhibits significant performance improvement in occluded environments.
[0091] In summary, the random feature interaction module based on genetic algorithm optimization proposed in this invention can improve the quality of pedestrian re-identification detection and can be inserted as a separate module into other frameworks as a strong baseline.
Claims
1. A pedestrian re-identification method based on a random feature interaction module optimized by a genetic algorithm, characterized in that, Includes the following steps: Step 1: Feature extraction; The input image undergoes feature projection through convolutional layers, achieving nonlinear mapping of local regions through convolutional kernels, significantly enhancing the initial features. Each patch of size [P, P] is converted into a one-dimensional embedding vector of dimension D, where the embedding dimension is strictly defined by the formula D = P²·C, and C is the number of input channels. After dimensional reconstruction, a normalized three-dimensional tensor [B, N, D] is formed, where B is the batch size, representing the number of images processed in a single batch; N is the number of patches, calculated from the image size and stride S; and D is the embedding dimension. The formula for calculating N is: (1) The patch sequence is as follows: (2) (3) (4) in, , , These represent the values in row a and column b of the red, green, and blue channels, respectively, with subscripts... , , These are the corresponding items. , , These represent the i-th terms of the red, green, and blue channels in the RGB channels, respectively. Let a and b be natural numbers, and F be a linear projection that maps the patch to D dimensions. , , These are the i-th items in the red, green, and blue channels, respectively; The flattened one-dimensional vector sequence is as follows: (5) To clarify the spatial structure information of the model, a set of parameters was used as the position embedding, with a length consistent with the input sequence, containing N+1 elements: N blocks + 1 class label [CLS], and a dimension of D. Through simple element-wise addition, the position information was directly superimposed onto the corresponding semantic embedding, enabling the model to distinguish blocks at different spatial locations. A class label was added before each patch, and the spatial relationship between patches was identified by accumulating the position embedding vectors. Then, the patch sequence blocks segmented from the image were input into the Transformer encoder, and the sequence representation is as follows: (6) in Indicates the input sequence embedding. Indicates category label, This represents the i-th linear projection at position p. Indicates positional embedding; Step 2: Feature learning; The feature learning part adopts an L-layer standardized Transformer encoder architecture, with each layer containing a cascaded structure: a multi-head self-attention module (MHSA) and a feedforward network module (FFN), and integrates layer normalization operations and residual connection techniques; the feature learning process adopts a resolution-preserving strategy: from the initial convolutional layer to all L-layer Transformer encoders, the spatial resolution of the feature map and the embedding dimension D remain unchanged. Step 3: Extraction of dual-branch features; Innovatively, a heterogeneous dual-branch structure is constructed at the end of the Transformer. The global feature extraction branch processes the hidden features of the last layer through the standard Transformer encoder, outputting a global feature vector representing the overall image semantics. Then, the Random Feature Interaction (RFIM) branch extracts local features, dividing all features into... Sub-features, represented as At the same time, each group shares the same learnable category label. Parameter reuse is achieved; then, the data is processed by a Transformer layer to generate fine-grained local features; the hidden features input to the last layer are defined as follows: (7) Step 4: RFIM dynamic feature optimization; First, the feature matrix is initialized. Based on the output of the (L-1)th layer Transformer, a list containing N+1 elements is constructed, which consists of N sub-blocks obtained from the segmentation and a category label. This represents the initial state of the matrix list. This represents the feature sequence of the i-th sub-block; then, a new matrix list is generated by expanding the original matrix list. Each element of the new list is defined by a characteristic. Random number of moves and number of random groups Generate recombination features and randomly move steps. Sample random integers from a discrete uniform distribution ranging from 0 to the maximum number of steps, and randomly group the samples into groups. It refers to the number of subsets into which features are divided in the feature space. Controlling the granularity of subspace division enables feature recombination and reduces overfitting. Defined as The number of random movement steps pass Implement feature cyclic shifting; random grouping number The feature index set is divided into Each set of features is aggregated by summing each item. , The new j value is obtained after cyclic shifting. Then, a category label is added to the beginning of each feature group and transmitted in parallel to the next step. Next, a flexible grouping strategy is adopted, and selection is made based on fitness. The fitness function of the t-th feature is... The formula for calculation is: (8) in, It is a fixed value C (C=1) minus the sum of the normalized classification loss and the triplet loss from the previous forward propagation. The cross-entropy loss function is used to calculate the difference between the model's output class prediction and the true class. This indicates the use of the triplet loss function. By calculating the distance between the anchor image and the positive sample image, and the distance between the anchor image and the negative sample image, a triplet loss is constructed, enabling the model to learn more discriminative features. Next, the selection probability of each feature combination is calculated. The calculation formula is: (9) pass The selection process employs both fitness and probability-based selection mechanisms; feature combinations with high fitness are retained, while those with low fitness are eliminated. The fitness of the resulting feature combinations is then assessed. Calculate the probability of selection The higher the fitness of a feature combination, the greater its probability of being selected; selection operation: (10) Building upon this, mutation and crossover operations are introduced to further optimize feature combinations. First, two index values, i and j, are randomly selected to determine the range of crossover. Then, features are copied from parent individuals to offspring individuals. This method can more effectively capture the interactions between features; crossover operations... Represented as: (11) in, This represents the feature resulting from the intersection of the i-th and j-th features; Then, a mutation operation is performed, randomly replacing elements in the feature matrix to further optimize the feature combination, resulting in a mutated sub-element matrix. This avoids getting trapped in local optima, reduces the risk of overfitting, and thus improves the model's generalization ability. Represented as: (12) Where G represents the characteristic matrix after Gaussian transformation, and The index is a specified subscript in the feature matrix, indicating the feature range to be mutated; then, a Gaussian value k is randomly generated and replaced with this value at the index. The corresponding feature location. Here, It is in and The randomly selected index indicates the target location of the mutated feature; in this way, and between The feature value at a given location is replaced with a new Gaussian value k, thereby achieving feature mutation. This helps the model explore a wider feature space during training, thus improving the model's performance. Indicates to and Characteristics resulting from variations between them; By progressively optimizing feature combinations through the aforementioned selection, mutation, and crossover operations, the search space can be adaptively explored. Subsequently, the features are concatenated, allowing local features to cover different parts of the pedestrian, including portions obscured by vehicles or other obstacles, ultimately yielding locally optimal features. , and To specify the percentage of mutation or crossover at random, the operation is as follows: (13) Then based on the obtained Encode local features as Calculate the local loss using a combination of features. Then use fitness To evaluate the quality of the reconstructed image, see Equation (8); Step 5: Loss Function and Joint Training; Based on the optimized features, the local features are encoded at this stage. 1 independent local feature vector Through the triplet loss function Calculate the distance between the anchor image and the positive sample image (of the same class) and the distance between the anchor image and the negative sample image (of different classes), using the cross-entropy loss function. The difference between the class prediction output by the calculation model and the true class is used to enable the model to learn more discriminative features; at the same time, the fitness function defined by equation (8) is used to evaluate the quality of feature reconstruction and drive the model to suppress noise interference; then the global features are... With local features By splicing along the channel dimension, a final joint representation is formed. By following the steps above, dynamic feature recombination can be performed based on the relationships between features, thereby forming an innovative feature processing flow that effectively improves pedestrian re-identification performance.