A pedestrian re-identification method, device, equipment and medium
By constructing a database of real irregular occlusion images and a mask-guided occlusion suppression mechanism, the problem of insufficient robustness and generalization ability of pedestrian re-identification in occluded scenarios is solved, and more efficient occluded region identification is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INNER MONGOLIA UNIV OF TECH
- Filing Date
- 2025-10-11
- Publication Date
- 2026-06-26
AI Technical Summary
Existing pedestrian re-identification technologies lack robustness and generalization ability in occluded scenarios. Existing occlusion enhancement methods lack semantic relevance and texture diversity in real-world scenarios, and occlusion suppression strategies lack clear spatial constraints, resulting in poor recognition performance.
A database of real irregular occlusion images is constructed. Occlusion images are simulated through affine transformation to generate pixel-level occlusion masks. Multi-head self-attention mechanism and mask-guided soft and hard suppression mechanism are used to dynamically adjust the attention weight distribution to improve the recognition effect of occluded areas.
It effectively simulates the occlusion distribution in real-world scenarios, improves pedestrian recognition performance in complex occlusion scenarios, and enhances the model's robustness and generalization ability.
Smart Images

Figure CN121281095B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision technology, and in particular to a method, apparatus, device, and medium for pedestrian re-identification. Background Technology
[0002] With the widespread deployment of intelligent video surveillance and security systems, Person Re-Identification (ReID) has significant application value in smart cities, traffic management, and public safety. Person Re-Identification is primarily used to determine the presence of a specific pedestrian in an image or video and to retrieve that pedestrian across different monitoring devices. It uses computer vision algorithms to match pedestrian images across devices, retrieving images of the same pedestrian from an image database given a monitored pedestrian image. For example, in intelligent security scenarios, the same target can be identified through pedestrian images captured by different cameras. In recent years, deep learning-based ReID methods have made significant progress, especially with the introduction of Visual Transformer (ViT) for feature extraction and the combination of various data augmentation strategies, continuously improving performance on public benchmarks. However, in real-world monitoring scenarios, pedestrians are often partially obscured by other objects (such as vehicles, umbrellas, traffic signs, etc.), resulting in a lack of visible area information, which severely affects the robustness and generalization ability of existing ReID models.
[0003] In specific pedestrian re-identification, given an original pedestrian image, re-identification is used to determine whether a pedestrian in an image captured by another device is that same pedestrian. Because pedestrians are often obscured in traffic scenarios, current processing methods randomize the obscurations into semantic erasure or random rectangular occlusions, such as... Figure 1 As shown, although it can improve the robustness of the model to occlusion to some extent, its synthetic occlusion lacks the semantic relevance and texture diversity of real scenes, making it difficult to simulate complex occlusion patterns. At the same time, in specific recognition, its occlusion suppression strategies include attention-based methods and auxiliary information-based methods. Attention-based methods learn the weight allocation of occlusion regions autonomously through the network, but they lack awareness of occlusion positions and are easily affected by background interference. Methods based on external auxiliary information rely on the accuracy of pre-trained models and are easily affected by domain differences.
[0004] Therefore, current occlusion enhancement methods lack semantic relevance and texture diversity in real-world scenarios, making it difficult to simulate complex occlusion patterns. Meanwhile, although occlusion suppression strategies introduce attention mechanisms or local structure modeling to focus on visible areas, they lack clear spatial constraints, resulting in poor pedestrian re-identification performance. Summary of the Invention
[0005] This invention provides a pedestrian re-identification method, apparatus, device, and medium, which can solve the problems existing in the prior art.
[0006] This invention provides a pedestrian re-identification method, comprising the following steps:
[0007] Acquire images of occluders with irregular edge occlusions in traffic scenes, as well as original pedestrian images and pedestrian target images;
[0008] Based on the type of occluder in the occluder image, set position and size constraints for the occluder to fill the area around the pedestrian in the pedestrian target image; based on the position and size constraints, perform an affine transformation on the occluder according to the pedestrian size to fit it around the pedestrian in the pedestrian target image to obtain a simulated occlusion image;
[0009] Mask feature extraction is performed on the simulated occlusion image to obtain the binary mask of the simulated occlusion image. The binary mask is converted into a Boolean vector, and a multi-head self-attention mechanism is used to obtain the attention weight matrix during feature extraction. The Boolean vector is converted into a weight vector, and the attention weight matrix is weighted element-wise using the weight vector to reduce the attention value of the occluded region to attenuate the attention weight of the occluded region. A negative bias value is subtracted from the attention score represented by the attenuated attention weight of each element in the occluded region to apply a negative offset to the attenuated attention weight element-wise, so as to suppress the attention weight matrix of the occluded region and obtain the suppressed attention weight matrix.
[0010] Based on the suppressed attention weight matrix, pedestrian features are extracted from the simulated occlusion image, and the pedestrian features are used to identify whether the pedestrian in the target image is the same as the pedestrian in the original pedestrian image.
[0011] Preferably, obtaining the simulated occlusion image includes:
[0012] The physical attributes of occluders and their interaction patterns with pedestrian targets are classified into several semantically guided occlusion types by the system: vehicle type, umbrella type, sign type and general type;
[0013] Based on the type of occlusion within the occlusion image, set the position and size constraints for the occlusion: the vertical starting position is forcibly limited to the lower half of the image, and the pedestrian image height is set to... Width is The size of the obstruction is , ,satisfy ; Horizontal positions are randomly sampled within the entire image width; In terms of dimensions, the maximum height and width of the obstruction are set to 50% of the pedestrian's height and 85% of its width, respectively, represented as... ;
[0014] Among them, the umbrella-type obstruction focuses on simulating the occlusion of the head and shoulder area by an umbrella, with its vertical position limited to the upper 20% area of the image, and its size limited to [specific dimensions]. , ;
[0015] Based on position and size constraints, the occlusion is subjected to an affine transformation to fit around the pedestrian in the pedestrian target image, thus obtaining a simulated occlusion image.
[0016] Preferably, when performing an affine transformation on the occluder according to the pedestrian size to fit it around the pedestrian in the pedestrian target image, it further includes:
[0017] Based on the remaining space at the target location, the obstruction is scaled up and down a second time;
[0018] The Lanczos interpolation algorithm is used to scale the occluded objects;
[0019] In the RGB color space, a multiplicative-additive transformation is introduced for each channel, which is expressed as:
[0020] ;
[0021] in: , This is used to simulate brightness shift and channel deviation.
[0022] Preferably, obtaining the Boolean vector includes:
[0023] The Alpha channel of the simulated occlusion image is used as a mask by separating the RGBA channels. The transparent areas completely preserve the background, while the opaque areas completely cover the pedestrian features. The occlusion area is represented as a binary map in pixel space, resulting in an occlusion mask map in PIL or Tensor format.
[0024] Utilizing the token-based computation method in the Vision Transformer deep learning model, the input mask is divided into patch-level Boolean mask vectors. For each sub-block, a minimum pooling operation is applied to determine whether the entire sub-block is occluded. If there are occluded pixels in the patch-level boolean mask vector, the entire patch-level boolean mask vector is considered occluded; otherwise, it is considered visible. This process converts the pixel-level occlusion mask map with resolution K×K into a token-level boolean vector, where each element represents whether the corresponding patch-level boolean mask vector in the Vision Transformer belongs to the visible region.
[0025] The one-dimensional Boolean Tensor generated after the transformation corresponds one-to-one with the tokens in the Vision Transformer.
[0026] Preferably, the weight suppression of the attention weight matrix includes:
[0027] The weight suppression of the attention weight matrix includes soft suppression and hard suppression;
[0028] Soft suppression utilizes occlusion masks obtained from image spatial mapping. The attention weight matrix is subjected to element-wise weighted decay; let the original attention weight matrix be... The weighted attention is represented as:
[0029] ;
[0030] in: , Control the degree of attenuation in the obscured area. Represents a vector consisting entirely of 1s; when When the corresponding weight is decayed to ;
[0031] Hard suppression directly imposes an explicit penalty on the attention score of the occluded region. Before attention softmax normalization, a negative offset is applied to the corresponding elements of the occluded region, as shown below:
[0032] ;
[0033] in: The hyperparameter is ; the suppressed attention is . ;
[0034] Let the total number of tokens be The number of obscured tokens is The occlusion probability is expressed as:
[0035] ;
[0036] when Soft suppression is used when necessary, otherwise hard suppression is used.
[0037] Preferably, acquiring the image of the occluder with irregular edge occlusion in a traffic scene includes:
[0038] Through public datasets, open-source network resources, and on-site footage, we collected images of occluders with scene representativeness of more than one hundred frames, covering typical occluded targets such as partial structures of vehicles, handheld items, and riding tools.
[0039] The target is separated from the background by an instance segmentation model, and the extracted occlusion contours are processed by an edge optimization algorithm to generate an occlusion image with natural irregular edges.
[0040] By employing a dynamic scaling strategy constrained by aspect ratio, the longest side of the occluded object is standardized to within 256 pixels, resulting in an image of an occluded object with irregular edges in a traffic scene.
[0041] This invention also provides a pedestrian re-identification device, comprising:
[0042] The image module is used to acquire images of occluders with irregular edges in traffic scenes, as well as the original pedestrian image and the pedestrian target image;
[0043] The occlusion module is used to set position and size constraints for the occlusion to fill the area around the pedestrian in the pedestrian target image according to the type of occlusion in the occlusion image; based on the position and size constraints, the occlusion is subjected to an affine transformation according to the size of the pedestrian to fit the occlusion around the pedestrian in the pedestrian target image to obtain a simulated occlusion image;
[0044] The suppression module is used to extract mask features from the simulated occluded image to obtain a binary mask of the simulated occluded image. The binary mask is converted into a Boolean vector, and a multi-head self-attention mechanism is used to obtain the attention weight matrix during feature extraction. The Boolean vector is converted into a weight vector, and the attention weight matrix is weighted element-wise using the weight vector to reduce the attention value of the occluded region to attenuate the attention weight of the occluded region. A negative bias value is subtracted from the attention score represented by the attenuated attention weight of each element in the occluded region to apply a negative offset to the attenuated attention weight element-wise, so as to suppress the attention weight matrix of the occluded region and obtain the suppressed attention weight matrix.
[0045] The recognition module is used to extract pedestrian features from the simulated occluded image based on the suppressed attention weight matrix, and to identify whether the pedestrian in the target image is the same pedestrian in the original pedestrian image based on the pedestrian features.
[0046] This invention also provides an electronic device, including a memory and a processor;
[0047] The memory is used to store computer programs;
[0048] When the processor executes the computer program stored in the memory, it implements the steps of the pedestrian re-identification method described above.
[0049] This invention also provides a computer-readable storage medium for storing a computer program, which, when executed by a processor, implements the steps of a pedestrian re-identification method as described above.
[0050] This invention provides a pedestrian re-identification method, apparatus, device, and medium, which have the following advantages compared with the prior art:
[0051] This invention acquires images of occluded objects with irregular edges and sets position and size constraints on these objects. The occluded objects are then transformed to fit within the pedestrian target image, effectively simulating occlusion distribution in real-world scenes. A pixel-level occlusion mask is generated from the simulated occluded image and converted into a weight vector. This weight vector is then used to element-wise weight the attention weight matrix to attenuate the attention weights in the occluded areas. A negative offset is applied to each element of the attenuated attention weights. This process, based on a mask-guided soft-hard dynamic suppression mechanism, adaptively and interactively adjusts the attention weight distribution, achieving dynamic constraints on attention weights from a pixel-level spatial perspective. This improves pedestrian recognition performance in complex occluded scenes. Attached Figure Description
[0052] Figure 1 A schematic diagram showing the comparison between simulated occlusion enhancement and occlusion in real-world scenarios using the current methods provided in this embodiment of the invention; wherein, (a) represents simulated occlusion; and (b) represents real occlusion;
[0053] Figure 2 This is a schematic diagram of the overall architecture of a pedestrian re-identification method provided in an embodiment of the present invention;
[0054] Figure 3 This is a schematic diagram illustrating the process of constructing an occluded image dataset for a pedestrian re-identification method provided in an embodiment of the present invention.
[0055] Figure 4 This is a schematic diagram comparing the original image and the simulated occlusion image of a pedestrian re-identification method provided in an embodiment of the present invention. Detailed Implementation
[0056] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Many specific details are set forth in the following description to provide a thorough understanding of the present invention. However, the present invention can be practiced in many other ways different from those described herein, and those skilled in the art can make similar modifications without departing from the spirit of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0057] Currently, in pedestrian re-identification tasks, models need to accurately identify the same pedestrian from different perspectives. However, in real-world scenarios, pedestrians are often partially occluded. Therefore, occluded pedestrian re-identification has become a key challenge in improving the practicality and robustness of the model. Occluded targets can lead to the loss of local features, affecting the re-identification effect of pedestrians. Existing methods can generally be divided into two categories: attention-based methods and auxiliary information-based methods.
[0058] In attention-based methods, consider using Transformer Encoder-Decoder architectures are used for occluded person re-identification, where the encoder captures context and the decoder discovers semantic components, forming a collaborative enhancement. One researcher proposed a person re-identification model based on local information, first extracting local feature representations of the target by predicting body part attention maps, then introducing a novel training strategy to learn body part representations that are resistant to occlusion and more robust to low-discrimination local appearances. Another researcher introduced a "semi-attention" mechanism, using noisy semantic segmentation as a teacher to guide the attention model, maintaining partial consistency while preserving adaptive capabilities, thus achieving robust and well-aligned feature learning. In methods based on auxiliary information, some researchers used pose information to clearly decouple semantic components (such as human body or joint parts) and selectively matched unoccluded parts accordingly. Another researcher introduced graph neural networks to construct feature neighborhoods in gallery images based on visible region features, effectively reconstructing the full-body representation of occluded areas through outlier suppression and neighborhood aggregation. Yet another researcher supplemented the input bounding box with keypoint information as additional semantics and constructed a novel ReID dataset containing keypoint annotations.
[0059] While the aforementioned methods have made significant progress in occluded scenarios, two problems remain: First, purely attention-based methods typically rely solely on identity-level supervision signals, neglecting the causal relationship between the attention map and the final recognition prediction. This may lead the model to mistakenly identify the background or occluded areas as key discriminative clues. Second, methods relying on external semantic models are susceptible to domain differences. Due to significant distributional differences between the pre-trained model and the target occluded image, performance instability often occurs when handling complex occlusions. Therefore, designing a Re-ID method that can explicitly perceive and model occlusion information is a noteworthy direction for improving the recognition performance and generalization ability of occluded pedestrians.
[0060] Occlusion-based data augmentation and reasonable occlusion suppression methods have been widely proven to be effective in occluded pedestrian re-identification tasks. Existing data augmentation strategies typically simulate occlusion by selecting regular rectangular regions in an image and replacing their pixels with random values or background noise. For example, some researchers use rectangular blocks containing background or occluders as occluders to cover pedestrian images to simulate non-pedestrian occlusion; others mix parts of the target pedestrian with parts of other pedestrians to simulate non-target pedestrians occluding the target pedestrian. These two types of methods improve the robustness of the model to occlusion to some extent, but because rectangular occlusion blocks often contain background information other than the occluder, they lack the semantic relevance and texture diversity of real-world scenes, making it difficult to fully cover complex occlusion patterns.
[0061] In the Person Re-Identification (ReID) task, occlusion suppression refers to the technical strategy of reducing or eliminating the interference of occluded regions on the pedestrian representation features, so as to improve the recognition accuracy and robustness of the model in occluded scenarios. Some researchers have proposed a novel feature erasure and diffusion network, which simulates and removes noisy occlusion features through an occlusion elimination module, and uses a feature diffusion module to synthesize real occlusion features in the visible area, thereby improving the model's ability to perceive occluded pedestrians. Other researchers have used visibility map matching to determine the similarity of shared visible areas in two images, and used the feature set of the k nearest neighbors in the image library to perform complete feature recovery. Some researchers have first designed a more reasonable local partitioning strategy, proposed a local relationship aggregation module, adaptively learns the visibility and interrelationships between different parts of the body, and then focuses on the unoccluded areas to achieve effective occlusion suppression.
[0062] While existing occlusion suppression methods have made some progress in improving the robustness of recognition in occluded scenes, they still have many shortcomings. First, most methods rely on the network to automatically perceive occluded regions in the image, lacking explicit modeling of the occlusion location, resulting in a relatively coarse suppression strategy that makes it difficult to accurately distinguish between occluded and visible regions. Second, existing methods often indirectly reduce the impact of occlusion through feature elimination, feature completion, or local relation modeling. However, without clear guidance on the occluded region, these mechanisms are prone to mis-suppressing visible regions or introducing redundant information, affecting the overall representation quality. In addition, although some methods introduce attention mechanisms or local structure modeling to focus on visible regions, they lack clear spatial constraints, making it difficult to ensure that the model always focuses on semantically effective non-occluded regions, especially in scenes with severe occlusion or complex background interference, where the suppression effect drops significantly.
[0063] Current mainstream occlusion enhancement methods are mostly based on simple semantic erasure or random rectangular occlusion, such as Figure 1 As shown, while these methods can improve the robustness of the model to occlusion to some extent, the synthesized occlusions lack the semantic relevance and texture diversity of real-world scenes, making it difficult to simulate complex occlusion patterns. Furthermore, existing occlusion suppression strategies often only introduce simple attention masking within the model, failing to form a closed-loop mechanism that collaborates with real irregular occlusions, resulting in occlusion information still interfering with feature learning. In addition, some studies have used synthetic or generative methods to introduce real occlusion libraries to enhance realism, but these still lack in terms of positional constraints and fusion details.
[0064] To address the problems existing in current technologies, this invention proposes an occlusion suppression method based on real irregular occlusion enhancement and occlusion position guidance, the architecture of which is as follows: Figure 2As shown; to verify the effectiveness of the proposed method in the occluded pedestrian re-identification task, PADE (Parallel Augmentation and Dual Enhancement) is used as the baseline; PADE does not require external auxiliary information (such as keypoints or segmentation), and improves the robustness of the model between occluded and unoccluded samples through a parallel enhancement mechanism (PAM, constructing base, erasing and cropping triplet samples) and a dual enhancement strategy (DES, global and local feature interaction); based on the overall architecture of PADE, this invention replaces its simple rectangular enhancement with realistic irregular occlusion simulation, and introduces a mask-guided dynamic suppression module in the multi-head attention mechanism to further improve the recognition effect in complex occlusion scenarios. Specifically:
[0065] I. Construction of the Occlusion Image Library
[0066] To improve the realism of occlusion simulation in pedestrian re-identification scenarios, this invention constructs a small-scale collection of realistic irregular occlusion images for traffic scenarios. By integrating publicly available datasets, open-source network resources, and real-world footage, 250 scene-representative occlusion images were collected, covering typical occlusion targets such as vehicle partial structures (e.g., doors, tires), handheld items (umbrellas, backpacks), and riding vehicles (bicycles, motorcycles). The construction process includes the following key steps: First, low-quality and semantically irrelevant images are filtered out to ensure the occluded object is complete and conforms to the characteristics of a traffic scene, and named according to the object category; the occluded object is accurately extracted; and the target is segmented using an instance segmentation model. Background separation is performed, and edge optimization algorithms (such as Canny edge detection and morphological closing operations) are combined to refine contour details, ultimately generating occluded object samples with natural, irregular boundaries. This method effectively avoids the jagged edges caused by manual cropping while preserving the complex geometric features of real occluded objects (such as umbrella rib structures and non-rectangular contours of vehicle parts). Finally, a dynamic scaling strategy with aspect ratio constraints is used to standardize the longest side of the occluded object to within 256 pixels, avoiding damage to pedestrian features due to excessive size. This image set combines the texture diversity of real scenes with standardized preprocessing characteristics, providing a high-quality data foundation for robust research on pedestrian features under complex occlusion. The construction process is as follows: Figure 3 As shown.
[0067] II. Enhancement methods for realistic irregular occlusions guided by human body parts.
[0068] The physical properties of occluders and their interaction patterns with pedestrian targets are systematically classified into various semantically guided occlusion types: vehicle type (car / bus / bike), umbrella type (umbrella), sign type (mark), and general type (others), etc. Each type of occluder is modeled and simulated accurately by introducing spatial constraint functions and scale regularization constraints based on its interaction characteristics in the real context, ensuring the consistency of the generated samples at the physical, geometric, and semantic levels.
[0069] Vehicle-type occlusions are used to simulate typical situations in urban traffic scenes where vehicles obscure the lower half of a pedestrian's body; considering that vehicle occlusion usually starts from the bottom of the image, its vertical starting position is forcibly limited to the lower half of the image; let the pedestrian image height be... Width is The size of the obstruction is , ,satisfy The horizontal position is randomly sampled within the entire width of the image; in terms of size, the maximum height and width of the obstruction are set to 50% of the pedestrian's height and 85% of its width, respectively. To ensure the preservation of the main upper body features; umbrella-type obstructions focus on simulating the occlusion of the head and shoulders area by an umbrella, with their vertical position strictly limited to the upper 20% of the image area and their size limited to [specific dimensions]. , To match the actual coverage area of the umbrella and preserve structural information such as the pedestrian's torso.
[0070] To enhance occlusion diversity, this method further introduces dynamic scaling and fitting, anti-aliasing, and color perturbation mechanisms.
[0071] Dynamic scaling and fitting: Based on the remaining space at the target location, the occluded object is scaled a second time to avoid exceeding the image boundary.
[0072] Anti-aliasing: The Lanczos interpolation algorithm (Image.LANCZOS) is used to scale occluded objects, reducing edge jaggedness and improving visual coherence.
[0073] Color perturbation: In the RGB space, a multiplicative-additive transformation is introduced for each channel, expressed as:
[0074] .
[0075] in: , It effectively simulates changes in lighting such as brightness shift and channel deviation.
[0076] Through the above mechanism, the generated occlusion image not only retains the complex texture information of the real occlusion, but also conforms to the semantic logic of the scene in terms of spatial layout (e.g., vehicles are usually located below pedestrians, and umbrellas often cover the head area). Furthermore, in the subsequent mask construction process, the occlusion mask is automatically generated by separating the alpha channel of the image, thereby providing accurate positional information support for the occlusion perception module. The image effect is as follows: Figure 4 As shown.
[0077] III. Mask-guided occlusion suppression.
[0078] The main operations include mask generation, mask processing, multi-scale attention adjustment, and occlusion suppression mechanisms; the overall process is as follows: Figure 2 As shown, it covers the data and feature processing process from preprocessing to network training.
[0079] 1. Mask generation and processing.
[0080] After occlusion enhancement is completed, the Alpha channel of the occluded image is used as a mask by separating the RGBA channels. The transparent area (alpha=0) completely preserves the background, and the opaque area (alpha=255) completely covers the pedestrian features. The occluded area is represented in pixel space as a binary map (1 represents the visible area and 0 represents the occluded area), and the output is an occlusion mask map in PIL or Tensor format.
[0081] To accommodate the token-based computation method in the Vision Transformer (ViT) structure, a dedicated MaskConverter utility class is introduced. This class is responsible for converting a pixel-level mask image with a resolution of K×K into a token-level boolean vector, where each element represents whether the corresponding patch in the ViT belongs to the visible region. Specifically, the input mask is first divided into patches ( For each sub-block, a minimum pooling operation is applied to determine whether the entire patch is occluded. If there are occluded pixels (value 0) in the patch, the entire patch is considered occluded; otherwise, it is considered visible. The one-dimensional boolean Tensor generated after the transformation corresponds one-to-one with the tokens in ViT.
[0082] 2. Data transmission and occlusion suppression.
[0083] The data loading module provides stable and efficient input support for the network training phase. Through a customized data reading and batch assembly process, it effectively adapts to occlusion-related tasks, ensuring that each training sample contains complete original image, occlusion image, and mask information, thereby helping the model to fully learn the features and patterns of occlusion behavior.
[0084] Transformer networks are susceptible to interference from occluded regions when processing occluded images. Therefore, an occlusion suppression mechanism is introduced, which controls the attention distribution through a mask to effectively reduce the influence of ineffective regions. The core design includes soft / hard suppression mechanisms and a suppression strategy selection module, specifically including:
[0085] Soft suppression: utilizes occlusion masks obtained from image spatial mapping. The attention weight matrix is subjected to element-wise weighted attenuation processing, thereby reducing the attention value in the occluded region; let the original attention weight matrix be... The weighted attention is represented as:
[0086] .
[0087] in: , Control the degree of attenuation in the obscured area. It is a vector of all 1s; when When (occluded), the corresponding weight will be decayed to This is to achieve "soft suppression" of the occluded area.
[0088] Hard Suppression: In scenarios with severe occlusion or where the occluded region significantly impacts the overall features, soft suppression may be insufficient to completely eliminate interference. Therefore, this invention further proposes a hard suppression strategy, which directly applies an explicit penalty to the attention score of the occluded region to achieve complete masking. Specifically, before attention softmax normalization, a negative offset is applied to the corresponding elements of the occluded region, expressed as:
[0089] .
[0090] in: `<input type>` is a hyperparameter that controls the suppression strength. The updated attention is... After the softmax operation, the attention weights related to the occluded area will approach zero, thus achieving "hard suppression".
[0091] Dynamic Suppression: Considering the significant differences in occlusion conditions among different images or samples, a suppression strategy selection module was designed to improve the adaptability of the suppression module. This module dynamically switches between soft and hard suppression, and determines the strategy based on the proportion of occluded tokens in the current input.
[0092] Let the total number of tokens be The number of obscured tokens is Then the occlusion probability is:
[0093] .
[0094] when A soft suppression strategy is used when necessary, and a hard suppression strategy is used otherwise.
[0095] 3. Loss function.
[0096] In this invention, the loss design inheriting from the baseline method only adjusts the augmentation method of the training data, changing the rectangular erasure to "realistic irregular occlusion simulation + mask-guided dynamic suppression", while the loss formula remains unchanged to ensure comparability with the baseline method. Its loss function is expressed as:
[0097] .
[0098] in: and These represent the cross-entropy loss and the triple loss function, respectively. Representing global features and local features The prediction results Represents the actual value.
[0099] Specific experiment:
[0100] 1. Dataset and Evaluation Methods.
[0101] To evaluate the effectiveness of the proposed method, experiments were conducted on four benchmarks: Occluded-DukeMTMC, Occluded-REID, Partial-REID, and Market1501.
[0102] Occluded-DukeMTMC: The DukeMTMC-reID dataset was split to generate a new Occluded-DukeMTMC dataset for the problem of occluded person re-identification. Unlike the original dataset, all QueryImages and 10% of Gallery Images in the new dataset are occluded Person images. Therefore, when calculating the pairwise distance between query and gallery images, there is always at least one occluded image.
[0103] Occluded-REID: This dataset was collected by a mobile camera device and contains 2000 images at a resolution of 128×64, involving 200 identities. Each identity corresponds to 5 full-body images and 5 images with different types of severe occlusion.
[0104] Partial-REID: This dataset contains 600 images from 60 identities, with 5 complete pedestrian images and 5 occluded images provided for each identity. The images were collected on a university campus by 6 cameras from different perspectives, backgrounds, and occlusion conditions, resulting in strong diversity in perspective and occlusion.
[0105] Market1501: Includes 1,501 pedestrians captured by 6 cameras and 32,668 detected pedestrian bounding boxes; each pedestrian is captured by at least 2 cameras and may have multiple images in one camera.
[0106] 2. Experimental details.
[0107] The model input image size is 256×128, and it uses a 16×16 patch partitioning method, generating 16×8 patches in each image. The backbone network structure is a Vision Transformer (ViT) with 12 Transformer layers, each layer containing a 768-dimensional embedding representation, 12 attention heads, and a multilayer perceptron (MLP) with a 4x scaling ratio. To improve robustness to occluded regions, a hybrid occlusion suppression mechanism is introduced, combining hard and soft suppression strategies, with a dynamic suppression threshold set to 0.3. The AdamW optimizer is used during training, with a base learning rate of 3.5×10⁻. 4 The weight decay coefficient was 0.0005, and the total number of training rounds was 200. The first 5 rounds were used for learning rate warm-up, and cosine annealing was used to adjust the learning rate thereafter. The label smoothing coefficient was set to 0.1. Each training round used a batch size of 64. For data augmentation, the training phase included random horizontal flipping, color perturbation (jitter amplitude of 0.2), realistic occlusion simulation (probability of 0.5), 10-pixel edge padding, and random cropping. In addition, to adapt to the occlusion handling mechanism, the image was transformed into a patch-level occlusion mask, and the occluded region was located and suppressed according to the 16×8 patch division dimension. The above settings ensured the robustness and generalization ability of the model in dealing with complex occlusion situations.
[0108] 3. Ablation experiment.
[0109] To verify the effectiveness of the proposed modules in the occluded person re-identification task, a systematic ablation experiment was conducted on the Occluded-Duke dataset. The baseline method of the experiment was based on the PADE method, using ViT as the backbone network, and was trained only under the supervision of the original Softmax loss and Triplet loss, without introducing any occlusion processing or enhancement mechanism. Based on this, the proposed modules were gradually introduced and their impact on model performance was observed.
[0110] First, data augmentation was performed using images of real occluders with rectangular edges. Compared to the baseline, training with only rectangular occluders effectively improved the model's performance, increasing Rank-1 accuracy from 71.4% to 72.3%, mAP from 62.0% to 62.3%, and Rank-10 accuracy from 86.4% to 87.6%. This demonstrates that using real occluders for simulation, introducing realistic textures, improves occlusion perception and robustness. After validating the effectiveness, the quality of the occluders was improved by using irregularly edged occluders with background removed for simulated occlusion. At this point, R1 accuracy increased to 72.8%, and mAP increased to 62.9%. Subsequently, data augmentation was added to this model. A location guidance module was introduced to simulate occlusion by real objects in realistic physical conditions. This exposes the model to more complex samples closer to real-world scenarios during training, further improving Rank-1 to 73.9% and mAP to 63.8%, validating the positive role of location guidance in making the model focus on non-occluded regions. Finally, using the occlusion location information provided by the location-guided random occlusion method, a dynamic occlusion suppression method combining hardware and software was used to control the focus on non-critical regions, improving mAP to 65.0%. To ensure the determinism of the ablation experiments, the same random seed was used for initialization in all experiments to ensure that the occlusion position was consistent with the model parameter initialization, thereby eliminating performance fluctuations caused by random factors. The ablation experiment results are shown in Table 1.
[0111] Table 1. Ablation experiment results of each module on the Occluded-Duke dataset.
[0112]
[0113] Furthermore, experiments were conducted on the Partial-ReID dataset to determine the optimal random occlusion probability. A comprehensive analysis of the experimental results shows that the model performance is optimal when the occlusion probability is set to 50%. The experimental results are shown in Table 2.
[0114] Table 2 Performance comparison of different random occlusion probabilities on the Partial-ReID dataset
[0115]
[0116] 4. Comparative experiment.
[0117] The proposed method was systematically compared with current representative state-of-the-art occluded person re-identification methods. Experiments were conducted on three challenging occluded datasets: Occluded-Duke, Occluded-ReID, and Partial-ReID. The results are shown in Table 3.
[0118] Table 3 Comparison of Occluded-Duke, Occluded-ReID, and Partial-ReID
[0119]
[0120] As shown in the table, on the most challenging Occluded-Duke dataset, our method achieves high accuracy in both mAP and Rank-1, with a 3% improvement in mAP accuracy compared to the baseline method (PADE). Compared to the state-of-the-art (SOTA) method CAM2Former, our method achieves 75.6% and 65.0% accuracy in Rank-1 and mAP, respectively, outperforming current SOTAs. On the smaller Partial-ReID and Occluded-ReID tasks, our method also achieves leading performance, only slightly lagging behind OA-reid on Occluded-ReID. This may be because the datasets used to simulate occlusion mainly focus on traffic scenes, with insufficient coverage of other scenes such as indoor environments. Nevertheless, considering that our method has not been specifically optimized for any particular scene, it still exhibits consistent performance advantages across multiple datasets, demonstrating good structural versatility and occlusion modeling capabilities. Therefore, this method still has significant application potential and superior generalization ability when expanded to multiple scenes.
[0121] 5. Comparison on a complete pedestrian dataset.
[0122] To verify its robustness to unoccluded data, experiments were also conducted on the Market1501 dataset, which mainly consists of complete pedestrians. The results are shown in Table 4. The method did not suffer any performance loss, demonstrating its applicability and stability to various data types.
[0123] Table 4 Comparison on the complete pedestrian dataset
[0124]
[0125] This invention constructs a high-quality, realistic occlusion database: for the first time, it systematically collects multiple categories of irregular occlusions for traffic scenarios and proposes a refined preprocessing workflow; a semantically guided occlusion synthesis strategy: based on pedestrian body parts and physical laws, it designs position and size constraints to improve the realism of occlusion simulation; a mask-guided multi-mode suppression mechanism is designed: it introduces patch-level occlusion masking and combines soft and hard suppression strategies to form a dynamic interactive attention adjustment; experimental verification and ablation analysis: comparative and ablation experiments are conducted on datasets such as Occluded-Duke, Occluded-REID, and Partial-REID, demonstrating the significant improvement of the method in Rank-1 and mAP metrics.
[0126] This invention presents a pedestrian re-identification framework based on realistic occlusion simulation and mask-guided suppression. Its core process includes: constructing a realistic occlusion database: collecting and labeling 250 common occlusion objects such as vehicle parts and umbrellas in traffic scenarios, and generating occlusion maps with irregular edges by manually stripping the background; semantically guided data augmentation: designing differentiated position and size constraints for different categories of occlusion objects (vehicles, umbrellas, signs, general objects, etc.) based on the distribution of human body parts and physical laws, achieving occlusion synthesis that closely resembles the scene height, and finally returning the simulated occlusion image and a pixel-level mask image recording the occlusion position; and mask-guided occlusion suppression: introducing a MaskConverter into the ViT network to convert pixel-level masks into patch-level token masking information, and selectively attenuating the attention response of occluded areas using soft / hard suppression strategies. This method constructs an "enhancement-suppression" closed loop from both the input data level and the model structure level, effectively improving the model's recognition ability under complex occlusion conditions.
[0127] This invention addresses pedestrian ReID in complex occlusion scenarios, proposing a holistic framework based on a real occlusion database, incorporating data augmentation, location guidance, and mask suppression. Research demonstrates that the method significantly improves the accuracy of occluded pedestrian recognition, providing a new approach and technical path for robust occlusion ReID. The proposed real occlusion simulation augmentation method and mask-guided dynamic occlusion suppression mechanism enhance the model's noise resistance and discriminative ability in real-world environments. Experimental results validate the method's performance advantages across multiple datasets. Future work could focus on optimizing the efficiency of the real occlusion simulation augmentation method, such as by combining it with generative models or adaptive sampling to reduce data augmentation overhead; exploring lighter network structures and suppression mechanisms to reduce practical deployment costs; and further investigating cross-domain adaptation strategies to maintain the model's robustness and generalization ability across different scenarios and camera distributions.
[0128] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.
Claims
1. A pedestrian re-identification method, characterized in that, Includes the following steps: Acquire images of occluders with irregular edges in traffic scenes, as well as original pedestrian images and pedestrian target images; Based on the type of occluder in the occluder image, set position and size constraints for the occluder to fill the area around the pedestrian in the pedestrian target image; based on the position and size constraints, perform an affine transformation on the occluder according to the pedestrian size to fit it around the pedestrian in the pedestrian target image to obtain a simulated occlusion image; Mask feature extraction is performed on the simulated occlusion image to obtain the binary mask of the simulated occlusion image. The binary mask is converted into a Boolean vector, and the attention weight matrix during feature extraction is obtained by using a multi-head self-attention mechanism. The Boolean vector is converted into a weight vector, and the attention weight matrix is weighted element by element using the weight vector to reduce the attention value of the occluded region to attenuate the attention weight of the occluded region. A negative bias value is subtracted from the attention score represented by the attenuated attention weight of each element in the occluded region to apply a negative offset to the attenuated attention weight element by element, so as to suppress the attention weight matrix of the occluded region and obtain the suppressed attention weight matrix. Based on the suppressed attention weight matrix, pedestrian features are extracted from the simulated occlusion image, and the pedestrian features are used to identify whether the pedestrian in the target image is the same as the pedestrian in the original pedestrian image. The acquisition of the Boolean vector includes: The Alpha channel of the simulated occlusion image is used as a mask by separating the RGBA channels. The transparent areas completely preserve the background, while the opaque areas completely cover the pedestrian features. The occlusion area is represented as a binary map in pixel space, resulting in an occlusion mask map in PIL or Tensor format. Utilizing the token-based computation method in the Vision Transformer deep learning model, the input mask is divided into patch-level Boolean mask vectors. For each sub-block, a minimum pooling operation is applied to determine whether the entire sub-block is occluded. If there are occluded pixels in the patch-level boolean mask vector, the entire patch-level boolean mask vector is considered occluded; otherwise, it is considered visible. This process converts the pixel-level occlusion mask map with resolution K×K into a token-level boolean vector, where each element represents whether the corresponding patch-level boolean mask vector in the Vision Transformer belongs to the visible region. The one-dimensional Boolean Tensor generated after the transformation corresponds one-to-one with the tokens in the Vision Transformer; The weight suppression of the attention weight matrix includes: The weight suppression of the attention weight matrix includes soft suppression and hard suppression; Soft suppression utilizes occlusion masks obtained from image spatial mapping. The attention weight matrix is subjected to element-wise weighted decay; let the original attention weight matrix be... The weighted attention is represented as: ; in: , Control the degree of attenuation in the obscured area. Represents a vector consisting entirely of 1s; when When the corresponding weight is decayed to ; Hard suppression directly imposes an explicit penalty on the attention score of the occluded region. Before attention softmax normalization, a negative offset is applied to the corresponding elements of the occluded region, as shown below: ; in: The hyperparameter is ; the suppressed attention is . ; Let the total number of tokens be The number of obscured tokens is The occlusion probability is expressed as: ; when Soft suppression is used when necessary, and hard suppression is used otherwise. The acquisition of images of occluders with irregular edges in a traffic scene includes: More than 100 images of occlusions with scene representation were collected through public datasets, open-source network resources and on-site footage, covering typical occlusion targets such as vehicle partial structures, handheld items and riding tools. The target is separated from the background by an instance segmentation model, and the extracted occlusion contours are processed by an edge optimization algorithm to generate an occlusion image with natural irregular edges. By employing a dynamic scaling strategy constrained by aspect ratio, the longest side of the occluded object is standardized to within 256 pixels, resulting in an image of an occluded object with irregular edges in a traffic scene.
2. The pedestrian re-identification method according to claim 1, characterized in that, The process of obtaining the simulated occlusion image includes: The physical attributes of occluders and their interaction patterns with pedestrian targets are classified into several semantically guided occlusion types by the system: vehicle type, umbrella type, sign type and general type; Based on the type of occlusion within the occlusion image, set the position and size constraints for the occlusion: the vertical starting position is forcibly limited to the lower half of the image, and the pedestrian image height is set to... Width is The size of the obstruction is , ,satisfy ; Horizontal positions are randomly sampled within the entire image width; In terms of dimensions, the maximum height and width of the obstruction are set to 50% of the pedestrian's height and 85% of its width, respectively, represented as... ; Among them, the umbrella-type obstruction focuses on simulating the occlusion of the head and shoulder area by an umbrella, with its vertical position limited to the upper 20% area of the image, and its size limited to [specific dimensions]. , ; Based on position and size constraints, the occlusion is subjected to an affine transformation to fit around the pedestrian in the pedestrian target image, thus obtaining a simulated occlusion image.
3. The pedestrian re-identification method according to claim 2, characterized in that, When performing an affine transformation on the occluder according to the pedestrian size to fit it around the pedestrian in the target pedestrian image, the method further includes: Based on the remaining space at the target location, the obstruction is scaled up and down a second time; The Lanczos interpolation algorithm is used to scale the occluded objects; In the RGB color space, a multiplicative-additive transformation is introduced for each channel, which is expressed as: ; in: , This is used to simulate brightness shift and channel deviation.
4. A pedestrian re-identification device, used to implement the steps of a pedestrian re-identification method as described in any one of claims 1 to 3, characterized in that, include: The image module is used to acquire images of occluders with irregular edges in traffic scenes, as well as the original pedestrian image and the pedestrian target image; The occlusion module is used to set position and size constraints for the occlusion to fill the area around the pedestrian in the pedestrian target image according to the type of occlusion in the occlusion image; based on the position and size constraints, the occlusion is subjected to an affine transformation according to the size of the pedestrian to fit the occlusion around the pedestrian in the pedestrian target image to obtain a simulated occlusion image; The suppression module is used to extract mask features from the simulated occlusion image to obtain the binary mask of the simulated occlusion image. The binary mask is converted into a Boolean vector, and the attention weight matrix during feature extraction is obtained by using a multi-head self-attention mechanism. The Boolean vector is converted into a weight vector, and the attention weight matrix is weighted element by element using the weight vector to reduce the attention value of the occluded region to attenuate the attention weight of the occluded region. A negative bias value is subtracted from the attention score represented by the attenuated attention weight of each element in the occluded region to apply a negative offset to the attenuated attention weight element by element, so as to suppress the attention weight matrix of the occluded region and obtain the suppressed attention weight matrix. The recognition module is used to extract pedestrian features from the simulated occluded image based on the suppressed attention weight matrix, and to identify whether the pedestrian in the target image is the same pedestrian in the original pedestrian image based on the pedestrian features.
5. An electronic device, characterized in that, include: Memory and processor; The memory is used to store computer programs; When the processor executes the computer program stored in the memory, it implements the steps of the pedestrian re-identification method as described in any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that, Used to store a computer program, which, when executed by a processor, implements the steps of a pedestrian re-identification method as described in any one of claims 1 to 3.