Group pedestrian re-identification method based on traffic scene
By constructing a training dataset for group pedestrian re-identification in traffic scenarios and conducting multi-stage training, the problems of dynamic changes in group members and layout uncertainty were solved, thereby improving the accuracy of group pedestrian re-identification.
Patent Information
- Application Number
- CN202511718146.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-21
- Publication Date
- 2026-02-27
AI Technical Summary
Existing technologies are difficult to adapt to the dynamic changes of group members and the uncertainty of group layout in traffic scenarios, resulting in low accuracy of group pedestrian re-identification.
A training dataset for group pedestrian re-identification based on traffic scenarios is constructed, which includes group pedestrian image data and their annotation information from different camera perspectives. Member changes are simulated by using binary masks, and group text description is performed using the CLIP model. Member change and group layout modules are constructed, and multi-stage training is conducted to generate group pedestrian re-identification results.
It adapts to the dynamic changes and layout uncertainties of group members in traffic scenarios, and improves the accuracy of group pedestrian re-identification.
Smart Images

Figure CN121582997A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of pedestrian re-identification technology, and more specifically to a group pedestrian re-identification method based on traffic scenarios. Background Technology
[0002] In existing technologies, traditional training datasets often focus on single, fixed scenes, lacking coverage of group imaging under multiple perspectives and time periods in traffic scenarios. Furthermore, they do not design simulation mechanisms for dynamic changes in members, making it difficult for models to adapt to fluctuations in the number and composition of group members in real traffic. At the same time, existing methods rely heavily on single visual features to represent group layouts, failing to incorporate cross-modal information to capture layout uncertainties. This results in insufficient feature extraction and matching accuracy when facing group images under different perspectives and lighting conditions, ultimately leading to low accuracy in re-identifying pedestrian groups and failing to meet the actual needs of traffic management scenarios such as pedestrian group tracking and abnormal behavior warnings.
[0003] Existing technologies have limitations in adapting to the dynamic changes in group members in traffic scenarios and in effectively addressing the uncertainty of group layout, resulting in low accuracy in re-identifying pedestrians in groups. Summary of the Invention
[0004] This application provides a group pedestrian re-identification method based on traffic scenarios, which is used to address the technical problem that existing technologies are difficult to adapt to the dynamic changes of group members in traffic scenarios, cannot effectively cope with the uncertainty of group layout, and thus have low accuracy in group pedestrian re-identification.
[0005] In view of the above problems, this application provides a method for re-identifying pedestrian groups based on traffic scenarios.
[0006] This application provides a method for re-identifying pedestrian groups in a traffic scenario, the method comprising:
[0007] A training dataset for group pedestrian re-identification is constructed based on traffic scenarios. The training dataset includes group pedestrian image data and their annotation information from different camera perspectives. A member change simulation module is constructed by randomly removing or retaining the group pedestrian image data using a binary mask. A group layout construction module is constructed by using the CLIP model for group text description. A first-stage training is performed based on the member change simulation module and the group layout construction module to generate the first-stage training result. A second-stage training is performed based on the first-stage training result to generate the group pedestrian re-identification result.
[0008] One or more technical solutions provided in this application have at least the following technical effects or advantages:
[0009] A training dataset for group pedestrian re-identification was constructed based on traffic scenarios. This dataset includes group pedestrian images from different camera perspectives and their annotation information. A member change simulation module was built by randomly removing or retaining members from the group pedestrian image data using a binary mask. A group layout construction module was constructed using the CLIP model for group text description. A first-stage training was performed based on the member change simulation module and the group layout construction module to generate the first-stage training result. A second-stage training was then performed based on the first-stage training result to generate the group pedestrian re-identification result. This approach effectively adapts to the dynamic changes and layout uncertainties of group members in traffic scenarios, thereby improving the accuracy of group pedestrian re-identification. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 A flowchart illustrating a method for re-identifying pedestrians in a traffic scenario, provided in an embodiment of this application;
[0012] Figure 2 This is a flowchart illustrating the process of constructing a member change simulation module in a traffic-scenario-based group pedestrian re-identification method provided in this application embodiment. Detailed Implementation
[0013] This application provides a group pedestrian re-identification method based on traffic scenarios, which addresses the technical problem in existing technologies that are difficult to adapt to the dynamic changes of group members in traffic scenarios, cannot effectively cope with the uncertainty of group layout, and result in low accuracy of group pedestrian re-identification.
[0014] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0015] Examples, such as Figure 1 As shown, this application provides a method for re-identifying pedestrian groups in traffic scenarios, the method comprising:
[0016] Step S100: Construct a group pedestrian re-identification training dataset based on traffic scenarios. The group pedestrian re-identification training dataset includes group pedestrian image data and their annotation information from different camera perspectives.
[0017] Specifically, a training dataset is constructed containing group pedestrian image data from different camera perspectives and corresponding annotation information. The specific steps are as follows: For traffic scenarios such as traffic light intersections, school gates, and areas around hospitals, video image data of the same group of pedestrians is collected using cameras from multiple different perspectives. Simultaneously, open-source group pedestrian re-identification datasets such as CSG, RoadGroup, and iLIDS-MCTS are supplemented to ensure the data covers diverse scenarios including changes in clothing, occlusion, and lighting differences. The data annotation process requires double annotation: group annotation includes group ID, group member IDs, and spatial / behavioral relationships between members, such as walking side-by-side; member annotation includes individual ID, target category, and bounding box coordinates. Additionally, auxiliary information such as camera number, shooting scene, and lighting conditions must be annotated. Finally, the image data and annotation information are integrated to form a complete group pedestrian re-identification training dataset.
[0018] Step S200: Randomly remove or retain the group of pedestrian image data using a binary mask to construct a member change simulation module.
[0019] Specifically, for each group of images in the group pedestrian re-identification training dataset, x is defined as... i Construct the corresponding binary mask m i Each element m in the mask i (j) corresponds to the j-th member of the i-th group, used to mark the retention or removal status of that member; where m i (j) follows a Bernoulli distribution β(1-p), where p follows a normal distribution N(μ,σ), and μ and σ are preset calculation parameters. i (j)=0 indicates the removal of the corresponding member, m i When (j)=1, it indicates that the member is retained. Next, the group members are filtered based on the mask value: a removal instruction is generated based on a mask value of 0, removing the corresponding member and generating the first member change data; a retention instruction is generated based on a mask value of 1, retaining the corresponding member and generating the second member change data, thus covering diverse scenarios of member increase / decrease and composition changes. Finally, by simulating and analyzing the two types of member change data and integrating the data processing logic under different change scenarios, a member change simulation module capable of accurately reproducing the dynamic changes of group members in traffic scenarios is finally constructed.
[0020] Step S300: Use the CLIP model to describe the group text and build the group layout building module.
[0021] Specifically, the training dataset for group pedestrian re-identification is traversed to identify group members and determine the appearance feature parameters of each member, such as clothing style and body shape. Then, the CLIP model is invoked to achieve cross-modal alignment of images and text through contrastive learning. Based on the member's appearance feature parameters, a preliminary text description is generated for each member. Simultaneously, to adapt to the uncertainty of group member layout in traffic scenarios, M learnable labels are defined for each member, such as [X]1, [X]2, ..., [X]. M These tags are embedded into the initial text description, so that the text contains both information about the appearance features of the members and the uncertainty of layout changes implied through learnable tags; then, the text descriptions of all members in the same group are aggregated to generate "a set of [P]1[P]2…[P]". K The group text description is in the form of "people", where K is the preset maximum number of group members, [P] k To integrate the group tag set of member uncertainty information, the group layout is modeled through the group text description, and finally a group layout building module that can represent the uncertainty of member appearance and layout is constructed.
[0022] Step S400: Perform the first stage of training based on the member change simulation module and the group layout construction module to generate the first stage training results.
[0023] Specifically, based on the member change data output by the member change simulation module, including diverse scenario data such as member removal and retention, combined with the group layout construction module's generated group text description containing member appearance features and layout uncertainties, such as "a group [P]1[P]2…[P]". K "People", K is the preset maximum number of members in the group, providing input data for training that covers dynamic changes in members and layout uncertainties; then, M learnable tags are defined for each member in the group to embed text descriptions, which are then aggregated into a complete group text description, and the first-stage contrastive learning loss function L is defined. stage1 =L i2t +L t2i L i2t For image-to-text contrast loss, L t2i For the text-to-image contrast loss, during training, matched group image-text pairs are treated as positive sample pairs and mismatched pairs as negative sample pairs. The similarity of the sample pairs is calculated using the cosine similarity function, and the similarity distribution is adjusted by combining the temperature parameter τ, so that the distance between positive sample pairs is shortened in the vector space and the distance between negative sample pairs is increased. Finally, the contrast learning loss function is optimized through multiple rounds of iteration to complete the training of the model's ability to align cross-modal features, and finally generate the first-stage training results that adapt to changes in members and layout uncertainties.
[0024] Step S500: Based on the training results of the first stage, perform the second stage training to generate the group pedestrian re-identification results.
[0025] Specifically, a group relationship encoder is constructed, which includes a group encoder and a member encoder. Both adopt the same visual Transformer network structure with n Transformer layers, each with a feature dimension of 512, containing an 8-head multi-head attention module and a feedforward neural network. Each layer optimizes feature transfer through residual connections and layer normalization. During training, the group encoder extracts the overall visual features V of the group from the data in the first stage. i The member encoder extracts the set of individual visual features S' of group members. i Then, through the cross-attention mechanism, with W q (V i ) for query, W k (S' i ) is the key, W v (S' i The values are used to perform feature interactions, generating enhanced group visual features V'. i Then, the total loss function L for the second stage is defined. stage2 =L ID +L tri :L ID The cross-entropy identity loss is used, with group ID as the label to determine group consistency; L tri The loss is calculated using a triplet loss function. This involves calculating the Euclidean distance between the anchor group features and the positive sample group features (which needs to be reduced), and the Euclidean distance with the negative sample group features (which needs to be increased), while constraining the loss using a constant parameter α. After optimizing the model parameters through backpropagation based on this total loss function, the optimized model is used to extract and match features from the first-stage training results. The final output is a group pedestrian re-identification result that can accurately identify the same pedestrian group from different camera perspectives.
[0026] In one possible implementation, step S100 further includes:
[0027] Step S110: Retrieve multiple traffic scenes based on the target traffic area, and collect images according to the multiple traffic scenes to obtain group pedestrian image data.
[0028] Step S120: Perform member analysis based on the group pedestrian image data to generate target bounding boxes.
[0029] Step S130: Annotate the group of pedestrian image data according to the target rectangle to generate annotation information for the group of pedestrian image data.
[0030] Step S140: Integrate the group pedestrian image data with the annotation information to construct the group pedestrian re-identification training dataset.
[0031] Specifically, the scope of the target traffic area is clearly defined, focusing on areas with frequent group pedestrian activity and high management needs in traffic scenarios, such as traffic light intersections on urban roads, school gates, and areas around hospitals. Multiple traffic scenarios covering different time periods, such as morning peak hours, evening peak hours, off-peak hours, and different lighting conditions, such as sunny days, cloudy days, and nighttime lighting environments, are retrieved to ensure the diversity and authenticity of scenario coverage. Then, for each retrieved traffic scenario, multiple high-position video surveillance devices with different perspectives are deployed to simultaneously collect video image data of the same group of pedestrians from different camera perspectives to capture the multi-angle appearance features and dynamic changes of the group of pedestrians. At the same time, in order to supplement the data volume and enrich the scenario diversity, in addition to the self-collected image data, open-source group pedestrian re-identification datasets such as CSG, RoadGroup, and iLIDS-MCTS are also introduced and integrated with the self-collected data to finally obtain group pedestrian image data covering multiple scenarios, multiple perspectives, and multiple conditions.
[0032] The collected group pedestrian image data, including self-collected multi-view traffic scene images and open-source dataset images, are processed one by one. Through object detection algorithms, such as deep learning-based pedestrian detection models, individual pedestrian groups in each image are distinguished and boundaries are identified, accurately separating each group member from the background area and overlapping or adjacent areas between different members. Subsequently, based on the member contours and spatial positions identified by the algorithm, a corresponding target bounding box is generated for each group member in each image. This bounding box clearly defines the member's range in the form of image pixel coordinates, specifically the pixel coordinate values of the upper left and lower right corners of the bounding box, ensuring that each group member can be selected independently and accurately.
[0033] Based on the generated target bounding boxes, multi-dimensional annotation is performed on the group pedestrian image data to generate complete annotation information. The specific process is as follows: The annotation work is divided into two parts: group level and member level. At the group level, a unique group identifier ID is assigned to each group pedestrian image, which is associated with the identifier IDs of all members in the group. The spatial or behavioral relationships between group members are also annotated, such as common group interaction patterns in traffic scenarios, such as walking side by side or following one another. At the member level, for each group member corresponding to the target bounding box, its independent member identifier ID and target category are annotated, clearly labeled as "pedestrian". At the same time, the pixel coordinates of the upper left and lower right corners of the member's target bounding box are bound to ensure that the member's identity and location information correspond one-to-one. In addition, it is necessary to supplement the annotation with auxiliary information related to image acquisition, including the camera number that acquired the image, the specific traffic scene captured by the camera, such as traffic light intersections, school gates, etc., and the lighting conditions at the time, such as natural light on a sunny day or artificial light at night. Through the integration of multi-dimensional information, complete annotation information for group pedestrian image data covering the group, members, and acquisition environment is finally generated.
[0034] A mapping mechanism is established between group pedestrian image data and annotation information. This mechanism uses unique identifiers, such as a unique ID for each image, to bind the acquired group pedestrian image data (including self-collected multi-view traffic scene images and supplementary open-source dataset images) to the generated annotation information. This annotation information includes group ID, member ID, corresponding target bounding box coordinates, spatial / behavioral relationships between members, camera numbers, scene and lighting conditions, etc., ensuring consistency between the image and annotation information in a single data entry. The bound data is then quality-checked, removing blurry images, missing or incorrect annotation information (such as bounding box coordinate deviations or incorrect ID associations), ensuring data integrity and accuracy. Finally, the validated "image data-annotation information" samples are organized and archived according to a preset format, such as a dataset format suitable for subsequent model training, forming a group pedestrian re-identification training dataset covering multiple traffic scenarios, multiple views, and multiple data conditions.
[0035] In one possible implementation, such as Figure 2 As shown, step S200 further includes:
[0036] Step S210: Traverse the group of pedestrian image data and generate a binary mask vector, wherein the binary mask vector corresponds to the group of pedestrian image data.
[0037] Step S220: Randomly set a mask value according to the Bernoulli distribution, wherein a mask value of 0 indicates the removal of a member, and a mask value of 1 indicates the retention of a member.
[0038] Step S230: When the mask value is 0, a removal instruction is generated. The binary mask vector is matched using the removal instruction, and the members of the pedestrian image data group corresponding to the binary mask vector being 0 are removed to generate the first member change data.
[0039] Step S240: When the mask value is 1, a retention instruction is generated. The binary mask vector is matched by the retention instruction, and the group pedestrian image data corresponding to the binary mask vector of 1 is retained to generate the second member change data.
[0040] Step S250: Based on the first member change data and the second member change data, perform simulation analysis to construct the member change simulation module.
[0041] Specifically, the group pedestrian image data in the constructed group pedestrian re-identification training dataset is traversed and processed, and each group of images containing multiple members is defined as x. i Generate a unique corresponding binary mask vector m i The dimension of the vector is consistent with the number of members in the corresponding group image. Each element in the vector maps to a member in the group, thereby establishing a one-to-one correspondence between the binary mask vector and the group pedestrian image data, providing a basic mapping basis for subsequent member selection.
[0042] The mask value is randomly set for each element in the binary mask vector based on the Bernoulli distribution: First, the probability parameter p of the Bernoulli distribution is determined, where p follows a normal distribution p~N(μ,σ), and μ and σ are preset calculation parameters. The probability of the mask value being 1 is 1-p, corresponding to retaining a member, and the probability of it being 0 is p, corresponding to removing a member. Through this random probability setting, the mask value can simulate the real situation of random increase or decrease of group members in traffic scenarios.
[0043] For elements with a mask value of 0, member removal logic is triggered: When an element with a mask value of 0 is detected in the binary mask vector, a member removal instruction is automatically generated. Based on the mapping relationship between the binary mask vector and the group image members, the group member corresponding to the mask value of 0 is removed from the original group pedestrian image data. After removal, the first member change data containing the member missing situation is formed, covering the scenario where the number of group members decreases.
[0044] For elements with a mask value of 1, the member retention logic is triggered: when an element with a value of 1 is detected in the binary mask vector, a member retention instruction is generated. Based on the same mapping relationship, the group members corresponding to the mask value of 1 are completely retained in the original group pedestrian image data. After retention, a second member change data is formed with the number of members remaining unchanged or partially retained, covering the scenario where the number of group members is stable or partially retained.
[0045] A comprehensive simulation analysis is conducted on the first type of member change data, namely the member removal scenario, and the second type of member change data, namely the member retention scenario. The change patterns of different numbers and compositions of members in the two types of data are integrated, the data processing logic and scenario mapping rules are extracted, and these rules are modularly encapsulated with the processes of binary mask generation, mask value judgment, and member selection. Finally, a member change simulation module that can accurately simulate the dynamic changes of group members in traffic scenarios is constructed.
[0046] In one possible implementation, step S300 further includes:
[0047] Step S310: Traverse the group pedestrian re-identification training dataset to identify members and determine multiple member parameters.
[0048] Step S320: Use the CLIP model to perform text description on the multiple member parameters to generate preliminary text description data.
[0049] Step S330: Define M learning tags for the multiple member parameters, embed the M learning tags into the preliminary text description data to obtain member text description data, where M is a positive integer greater than 0.
[0050] Step S340: Aggregate the member text description data to generate group text description data;
[0051] Step S350: Based on the group text description data, perform layout to construct the group layout construction module.
[0052] Specifically, a comprehensive traversal of the constructed group pedestrian re-identification training dataset is performed, and member identification is completed for each member in each group image in the dataset. The individual attributes of different members are clearly distinguished, and multiple member parameters covering member appearance features, such as clothing color, style, body shape, etc., and location information are determined, providing a data foundation for subsequent text description generation.
[0053] The CLIP model is invoked to achieve cross-modal alignment between images and text through contrastive learning. Multiple determined member parameters are input into the model, and the model's ability to understand the association between image content and text semantics is utilized to generate preliminary text description data containing the core features of each member, such as "a pedestrian wearing a blue shirt and black pants". This initially establishes the correspondence between the visual features of members and the text semantics.
[0054] To adapt to the uncertainty of group member layout in traffic scenarios, M learnable labels are defined for multiple parameters of each member, where M is a positive integer greater than 0, such as [X]1, [X]2, ..., [X]. MThese tags are used to capture distinctive descriptions of membership and potential layout change information; then these M learnable tags are embedded into the generated preliminary text description data to form member text description data that contains both specific member characteristics and implicit uncertainty information.
[0055] The text description data of all members within the same group are aggregated and combined with the preset maximum number of members K in the group to form a set of "[P]1[P]2…[P]". K Group text description data in the form of "people", where [P] k For the k-th group, the tag set integrates the text descriptions and learnable tags of the corresponding members, realizing the text representation of the overall features and structure of the group.
[0056] Based on the generated group text description data, the modeling and design of the group layout are further completed, the mapping relationship between the text description and the group visual layout is clarified, and the group text description generation logic, member feature aggregation rules, etc. are encapsulated into a complete module. Finally, a group layout construction module that can represent member features and layout uncertainty is constructed.
[0057] In one possible implementation, step S400 further includes:
[0058] Step S410: Calculate the number of members in the group text description data based on the M learning tags to obtain member number information.
[0059] Step S420: Sort the group text description data in descending order according to the number of members to generate a descending sequence.
[0060] Step S430: Extract the first order based on the descending sequence to generate the Kth group tag set, where K is the maximum number of members in the group text description data.
[0061] Step S440: Define a contrastive learning loss function, and perform a comparative analysis on the member change simulation module and the group layout construction module based on the contrastive learning loss function to obtain two sample pairs, which include positive sample pairs and negative sample pairs.
[0062] Step S450: Perform cosine similarity analysis on the positive sample pair and the negative sample pair to obtain the cosine similarity.
[0063] Step S460: Based on the cosine similarity and the Kth group label set, perform symmetric calculation of the contrast loss between the positive sample pairs and the negative sample pairs to generate the first stage training results.
[0064] Specifically, based on the defined M learning tags, the number of members in the generated group text description data is counted: by identifying the M learning tags embedded in each group text description, such as [X]1, [X]2, ..., [X] M By analyzing the quantity and relationships of data, the actual number of members in the corresponding group can be calculated in reverse, thereby obtaining information on the number of members covering all groups and providing a quantitative basis for subsequent data sorting.
[0065] Based on the obtained member count information, all group text description data are sorted in descending order: the number of members in the group is used as the sorting criterion, and the text description data of groups with more members are placed in the first column and the group with fewer members is placed in the second column. This generates a descending sequence arranged according to the decreasing number of members, which is convenient for extracting core group tag information later.
[0066] For the generated descending sequence, extract the group text description data of the first position in the sequence: since the number of group members corresponding to this position is the largest, extract the group label set and define it as the Kth group label set, where K is the maximum number of members in all group text description data. This label set integrates the characteristics and uncertainty information of the group with the largest number of members, and provides a benchmark reference for subsequent loss calculation.
[0067] Define the contrastive learning loss function L for the first stage. stage1 =L i2t +L t2i L i2t For image-to-text contrast loss, L t2i The text-to-image contrast loss is used. Then, the member change data output by the member change simulation module and the group text description data generated by the group layout construction module are called. The matching "group image-text" combination is used as a positive sample pair, such as an image and corresponding text description of the same group. The mismatched combination is used as a negative sample pair, such as an image and text description of different groups. Through the logical judgment of the contrast learning loss function, a pair of samples containing positive and negative sample pairs is finally obtained.
[0068] The cosine similarity function is used to calculate the similarity of the obtained positive and negative sample pairs: the visual feature vector of the group image in the positive sample pair and the semantic feature vector of the corresponding text description are input into the function to calculate the cosine similarity between the two; similarly, the cosine similarity between the visual feature vector and the semantic feature vector in the negative sample pair is calculated to quantify the feature alignment degree of different sample pairs and obtain the corresponding cosine similarity results.
[0069] Combining the cosine similarity results with the generated Kth group label set, a symmetrical calculation of the contrastive loss is performed on the positive and negative sample pairs: using the features of the Kth group label set as a benchmark, the cosine similarity weights of the positive sample pairs are adjusted to further shorten their distance in the vector space, while the weights of the negative sample pairs are adjusted to further widen their distance; this is then substituted into the contrastive learning loss function L. stage1 After calculating the loss value, iterative optimization is used to converge the loss value, ultimately generating the first-stage training results.
[0070] In one possible implementation, step S440 further includes:
[0071] Step S441: Define the contrastive learning loss function for the first stage.
[0072] Step S442: Match the group pedestrian image data with the group text description data to obtain a matching result, the matching result including matching data and non-matching data.
[0073] Step S443: Construct a first group of image-text pairs based on the matching data, and construct a second group of image-text pairs based on the non-matching data.
[0074] Step S444: Analyze the first group of image-text pairs based on the contrastive learning loss function to construct the positive sample pairs.
[0075] Step S445: Analyze the second group of image-text pairs based on the contrastive learning loss function to construct the negative sample pairs.
[0076] Specifically, the defined contrastive learning loss function is the contrastive loss from image to text. Contrast loss compared to text-to-image It consists of two parts, and the overall expression is: .in, Used to constrain the alignment of image features with text features, its calculation method is as follows: =- N represents the training batch size. Cosine similarity for positive sample pairs. τ is the cosine similarity of negative sample pairs, τ is a temperature parameter to control the similarity distribution, and p(i) is the number of positive samples in the current training batch. Used to constrain the alignment of text features to image features, its calculation logic is the same as... Symmetrical, only adjusting the order of feature matching during similarity calculation, i.e., calculating... This symmetrical loss constraint ensures that cross-modal features can be accurately aligned in the vector space.
[0077] The group pedestrian image data processed by the member change simulation module, including scene data of member removal / retention, is matched one-to-one with the group text description data generated by the group layout construction module, including member appearance features and layout uncertainty markers. If a group pedestrian image and its corresponding group text description belong to the same pedestrian group, that is, the text description accurately represents the member features and structure of the group in the image, then it is determined to be matching data; if the two belong to different pedestrian groups, that is, the text description and the image group features do not match, then it is determined to be non-matching data. Finally, the matching result containing matching data and non-matching data is output.
[0078] Image-text pairs are constructed based on the matching results: the combination of "group pedestrian image-group text description" in the matching data is encapsulated into the first group image-text pair, ensuring that the semantics and features of the images and texts in this type of pair are highly consistent; the combination of "group pedestrian image-group text description" in the non-matching data is encapsulated into the second group image-text pair, in which the images and texts have no corresponding relationship.
[0079] The first group of image-text pairs is analyzed based on a defined contrastive learning loss function: The cosine similarity between the visual features of the images and the semantic features of the text in the first group of image-text pairs is calculated to verify whether they meet the constraint of "high feature alignment" for positive sample pairs. If the similarity reaches a preset threshold, it meets the requirements of the loss function. The calculation logic then determines the first group of image-text pairs as positive sample pairs, which are used as training constraints to shorten the feature distance in subsequent training.
[0080] Similarly, the second group of image-text pairs is analyzed based on the contrastive learning loss function: the cosine similarity between the image visual features and the text semantic features is calculated. If the similarity is lower than a preset threshold, it meets the requirements of the loss function. The calculation logic determines that the second group of image-text pairs is a negative sample pair, which is used as a training constraint for the subsequent extension feature distance, and finally completes the construction of positive and negative sample pairs.
[0081] In one possible implementation, step S500 further includes:
[0082] Step S510: Construct a group relationship encoder, which includes a group encoder and a member encoder.
[0083] Step S520: Extract the overall visual features of the group based on the group encoder, and extract the individual visual features of the group members based on the member encoder.
[0084] Step S530: Using the overall visual features of the group as the query and the individual visual features of the members as the key and value, perform feature interaction calculation to generate group visual enhancement features.
[0085] Step S540: Based on the group visual enhancement features, combine the identity loss function and the triplet loss function to optimize the model parameters and generate the parameter optimization results.
[0086] Step S550: Based on the parameter optimization results, perform feature extraction and matching on the first stage training results, and output the group pedestrian re-identification results.
[0087] Specifically, a group relationship encoder is first constructed, consisting of a group encoder and a member encoder, both employing identical visual Transformer network structures. This visual Transformer network contains n Transformer layers, where n can be set to 5, with each layer having a feature dimension of 512. Each Transformer layer is further divided into a multi-head attention module (with a maximum of 8 heads) and a standard feedforward neural network. Each sub-layer incorporates residual connections and layer normalization operations. The output of the multi-head attention module is residually connected to the encoder layer input, then normalized before being fed into the feedforward neural network. The output is then again residually connected and normalized, ensuring the stability and effectiveness of feature propagation.
[0088] Feature extraction is performed based on the constructed group relationship encoder: the group image data from the first-stage training results are input into the group encoder, which captures the overall visual features of the group from a global perspective, defined as V. i Simultaneously, the local image data corresponding to each member in the same group of images are input into the member encoder, which extracts the individual visual features of each group member and integrates them to form a set of individual visual features of the members, defined as S'. i .
[0089] Feature interaction computation is performed using a cross-attention mechanism: taking the extracted group-wide visual features V as an example. i Based on this, the matrix parameter W was queried. q Convert to a query vector; convert the set of visual features of individual members S' i The bond matrix parameters W are respectively k Value matrix parameter W v The data is converted into key and value vectors; then, cross-attention operations are used to achieve interaction between queries, keys, and values, fully integrating global group features and local member features, ultimately generating a more information-rich and accurate group visual enhancement feature V'. i .
[0090] Model parameter optimization based on group visual enhancement features: First, define the second-stage total loss function L. stage2 =L ID +L tri L IDThe identity loss function is used to classify group identities. Group IDs are used as training labels, and the cross-entropy loss function is employed to calculate the difference between the model's predicted ID category and the labeled ground truth, thus constraining the model to accurately determine the consistency of identities across different groups; L tri For the triplet loss function, construct triplet samples consisting of anchor group A, positive sample group P (which is in the same group as A), and negative sample group N (which is in a different group from A). Calculate the Euclidean distance between the anchor group features and the positive sample group features, which needs to be reduced; the Euclidean distance between the anchor group features and the negative sample group features needs to be increased, and a constant parameter α is introduced to constrain the loss. Then, L... ID With L tri The summation of the calculation results yields the total loss for the second stage. Backpropagation is then performed based on this total loss to iteratively adjust the parameters of the group relationship encoder and related modules, generating parameter optimization results.
[0091] Feature extraction and matching are performed based on the optimized model: all group data from the first stage training results are input into the optimized model to extract the visual enhancement features of each group; then the similarity between the features of the group to be re-identified and the existing group features in the database is calculated, and the matching results with the highest similarity and meeting the preset threshold are selected; finally, the corresponding relationship of the same pedestrian group under different camera views is output according to the matching results, that is, the group pedestrian re-identification results.
[0092] In one possible implementation, step S540 further includes:
[0093] Step S541: Based on the identity loss function and the group visual enhancement features, calculate the cross-entropy loss by using the group identifier ID as the classification label to generate identity loss parameters.
[0094] Step S542: Based on the triplet loss function and the group visual enhancement features, construct triplet samples. The triplet samples include anchor group, positive sample group and negative sample group, wherein the anchor group and the positive sample group belong to the same group, and the anchor group and the negative sample group belong to different groups.
[0095] Step S543: Perform feature analysis based on the anchor group, the positive sample group, and the negative sample group to obtain anchor group features, positive sample group features, and negative sample group features.
[0096] Step S544: Calculate the Euclidean distance between the anchor point group features and the positive sample group features to generate the first group feature distance.
[0097] Step S545: Calculate the Euclidean distance between the anchor point group features and the negative sample group features to generate the second group feature distance.
[0098] Step S546: Perform loss analysis based on the feature distance of the first group and the feature distance of the second group to obtain triplet loss parameters.
[0099] Step S547: Sum the identity loss parameter and the triplet loss parameter to obtain the total loss parameter for the second stage.
[0100] Step S548: Optimize the model parameters through backpropagation based on the total loss parameters of the second stage, and generate the parameter optimization results.
[0101] Specifically, the identity loss parameter is calculated based on the identity loss function and combined with the generated group visual enhancement features: the identifier ID of each group is used as the classification label, the group visual enhancement features are input into the model classification layer, the difference between the group ID category predicted by the model and the labeled true ID is calculated through the cross-entropy loss function, the classification error of the model on the group identity is quantified, and finally the identity loss parameter is generated.
[0102] Triple samples are constructed based on the triple loss function and group visual enhancement features: From the group data of the first stage training results, any group is selected as the anchor group (A), another group belonging to the same pedestrian group as the anchor group is selected as the positive sample group (P), and a group belonging to a different pedestrian group than the anchor group is selected as the negative sample group (N). The three together form a set of triple samples to ensure that the samples cover the feature comparison scenarios of "same group" and "different groups".
[0103] The constructed group relationship encoder is retrieved, which includes a group encoder and a member encoder with identical structures. Both adopt a visual Transformer network, containing n Transformer layers, an 8-head multi-head attention module, and a feedforward neural network, combined with residual connections and layer normalization. Then, the image data corresponding to the anchor group, positive sample group, and negative sample group in the triplet samples are input into the group relationship encoder respectively. First, the member encoder extracts the individual visual feature set of each member in each group. Then, through a cross-attention mechanism, the individual features are interactively fused with the preliminary global features extracted by the group encoder to generate group visual enhancement features specific to each group. Finally, the visual enhancement features obtained after the encoder processing of the anchor group, positive sample group, and negative sample group are defined as anchor group features, positive sample group features, and negative sample group features, respectively.
[0104] The calculation objects are clearly defined as the obtained anchor group features and positive sample group features. Both are generated by a group relationship encoder, which includes a visual Transformer network and a cross-attention mechanism, and have a vector form representing the fusion information of the group's global and members' local information. Then, the Euclidean distance calculation formula is used to calculate the difference between the corresponding dimension elements of the two feature vectors, sum the squares, and then take the square root of the summation result to quantify the distance between the anchor group features and the positive sample group features in the vector space. Since the anchor group and the positive sample group belong to the same pedestrian group, this distance value intuitively reflects the similarity of the features of the same group. The smaller the distance, the higher the feature consistency. Finally, this calculation result is defined as the first group feature distance, which provides core distance data for the subsequent calculation of triplet loss parameters.
[0105] The two types of features required for the calculation—anchor group features and negative sample group features—are identified. Both are group visual enhancement features generated by a group relationship encoder, including a visual Transformer network and a cross-attention mechanism. These features fully represent the fusion result of global visual information and local features of the group members in high-dimensional vector form. Since the anchor group and negative sample group belong to different pedestrian groups, their feature differences need to be reflected through distance calculation. Subsequently, the Euclidean distance method is used to calculate the difference between the corresponding elements of the anchor group feature vector and the negative sample group feature vector. The squared results of all dimensional differences are summed, and the square root of the sum is taken to obtain the distance value between the two types of features in the vector space. This distance value reflects the degree of difference between the features of different groups; the larger the distance, the higher the discriminative power of the two groups. This calculated result is defined as the second group feature distance, providing crucial distance data support for the calculation of the triplet loss parameters in subsequent steps.
[0106] Using the generated first group feature distance and the generated second group feature distance as core data, triplet loss calculation and analysis are performed. The specific process is as follows: First, the calculation logic of the triplet loss function is clarified. Constraints are needed to ensure that the first group feature distance (i.e., the feature distance within the same group) is less than the second group feature distance (i.e., the feature distance between different groups). A constant parameter α, i.e., a preset interval threshold, is introduced to ensure the discriminative power of different group features, thus constructing the loss calculation expression. Then, the squares of the first group feature distance and the squares of the second group feature distance are substituted into the triplet loss function formula: ,in The square of the feature distance of the first group. The square of the feature distance of the second group. Anchor point group features, Features of the positive sample group The loss value calculated using this formula, which represents the negative sample group features, quantifies the degree of error in "features in the same group not being brought closer" or "features in different groups not being pushed further apart". This loss value is ultimately defined as the triplet loss parameter.
[0107] The generated identity loss parameter and the generated triplet loss parameter are numerically summed to obtain the total loss parameter for the second stage. This parameter comprehensively reflects the total error of the model in both group identity classification and feature distance constraint.
[0108] Backpropagation optimization is carried out based on the total loss parameter in the second stage: the gradient of the total loss parameter to the group relationship encoder, including the parameters of each network layer of the group encoder and member encoder, is calculated by the gradient descent algorithm. The weights, biases and other parameters are iteratively adjusted according to the gradient direction to continuously reduce the total loss parameter until the total loss converges to the preset threshold, and finally the model parameter optimization result is generated.
[0109] It should be noted that the order of the embodiments described above is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, the above description focuses on specific embodiments of this specification. Additionally, the processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired results. In some implementations, multitasking and parallel processing are possible or may be advantageous.
[0110] The above description is only a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
[0111] This specification and accompanying drawings are merely illustrative examples of this application and are intended to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from its scope. Therefore, if such modifications and variations fall within the scope of this application and its equivalents, this application intends to include such modifications and variations.
Claims
1. A method for re-identifying pedestrian groups in traffic scenarios, characterized in that, The method includes: A training dataset for re-identifying group pedestrians is constructed based on traffic scenarios. The training dataset for re-identifying group pedestrians includes group pedestrian image data and their annotation information from different camera perspectives. A member change simulation module is constructed by randomly removing or retaining the group of pedestrian image data using a binary mask; Using the CLIP model for group text description, a group layout building module is constructed. The first stage of training is performed based on the member change simulation module and the group layout construction module to generate the first stage training results. The second stage of training is conducted based on the results of the first stage of training to generate group pedestrian re-identification results.
2. The method for re-identifying pedestrian groups based on traffic scenarios as described in claim 1, characterized in that, A training dataset for group pedestrian re-identification is constructed based on traffic scenarios. This dataset includes group pedestrian image data from different camera perspectives and their annotation information. The method includes: Based on the target traffic area, multiple traffic scenes are retrieved, and images are acquired according to the multiple traffic scenes to obtain group pedestrian image data. Member analysis is performed on the group of pedestrian image data to generate target bounding boxes; The group of pedestrian image data is labeled according to the target rectangle to generate the labeling information of the group of pedestrian image data; The group of pedestrian image data and the annotation information are integrated to construct the group of pedestrian re-identification training dataset.
3. The method for re-identifying pedestrian groups based on traffic scenarios as described in claim 1, characterized in that, A member change simulation module is constructed by randomly removing or retaining pedestrian image data from the group using a binary mask, the method of which includes: Traverse the group of pedestrian image data to generate a binary mask vector, wherein the binary mask vector corresponds to the group of pedestrian image data; The mask value is randomly set according to the Bernoulli distribution, wherein a mask value of 0 indicates that a member is removed, and a mask value of 1 indicates that a member is retained; When the mask value is 0, a removal instruction is generated. The binary mask vector is matched using the removal instruction, and the group of pedestrian image data corresponding to the binary mask vector of 0 is removed to generate the first member change data. When the mask value is 1, a retention instruction is generated. The binary mask vector is matched using the retention instruction, and the group of pedestrian image data corresponding to the binary mask vector of 1 is retained to generate second member change data. The member change simulation module is constructed by performing simulation analysis based on the first member change data and the second member change data.
4. The method for re-identifying pedestrian groups based on traffic scenarios as described in claim 1, characterized in that, Using the CLIP model for group text description and constructing a group layout building module, the methods include: The group pedestrian re-identification training dataset is traversed to identify members and determine multiple member parameters; The CLIP model is used to perform textual descriptions on the multiple member parameters to generate preliminary textual description data. M learning tags are defined for the multiple member parameters, and the M learning tags are embedded into the initial text description data to obtain member text description data, where M is a positive integer greater than 0; The member text description data is aggregated to generate group text description data; The group layout construction module is constructed based on the group text description data.
5. The method for re-identifying pedestrian groups based on traffic scenarios as described in claim 4, characterized in that, The first stage of training is performed based on the member change simulation module and the group layout construction module to generate the first stage training results. The method includes: Based on the M learning tags, the number of members in the group text description data is calculated to obtain member number information; The group text description data is sorted in descending order according to the number of members to generate a descending sequence. Based on the descending sequence, the first order is extracted to generate the Kth group tag set, where K is the maximum number of members in the group text description data; Define a contrastive learning loss function, and perform a comparative analysis on the member change simulation module and the group layout construction module based on the contrastive learning loss function to obtain two sample pairs, which include positive sample pairs and negative sample pairs. Cosine similarity analysis is performed on the positive sample pairs and the negative sample pairs to obtain the cosine similarity. Based on the cosine similarity and the Kth group label set, the positive sample pairs and the negative sample pairs are compared and symmetrically calculated to generate the first stage training results.
6. The method for re-identifying pedestrian groups based on traffic scenarios as described in claim 5, characterized in that, Define a contrastive learning loss function, and perform a comparative analysis on the member change simulation module and the group layout construction module based on the contrastive learning loss function to obtain two-sample pairs, which include positive sample pairs and negative sample pairs. The method includes: Define the contrastive learning loss function for the first stage; The group of pedestrian image data is matched with the group of text description data to obtain a matching result, which includes matching data and non-matching data. A first group of image-text pairs is constructed based on the matching data, and a second group of image-text pairs is constructed based on the non-matching data. Based on the contrastive learning loss function, the first group of image-text pairs are analyzed to construct the positive sample pairs; The negative sample pairs are constructed by analyzing the second group of image-text pairs based on the contrastive learning loss function.
7. The method for re-identifying pedestrian groups based on traffic scenarios as described in claim 1, characterized in that, The second stage of training is performed based on the results of the first stage of training to generate group pedestrian re-identification results. The method includes: Construct a group relationship encoder, which includes a group encoder and a member encoder; The overall visual features of the group are extracted based on the group encoder, and the individual visual features of the group members are extracted based on the member encoder. Using the overall visual features of the group as the query and the individual visual features of the members as the keys and values, feature interaction calculations are performed to generate group visual enhancement features; Based on the group visual enhancement features, the model parameters are optimized by combining the identity loss function and the triplet loss function to generate the parameter optimization results. Based on the parameter optimization results, feature extraction and matching are performed on the first stage training results to output the group pedestrian re-identification results.
8. The method for re-identifying pedestrian groups based on traffic scenarios as described in claim 7, characterized in that, Based on the group visual enhancement features, the model parameters are optimized using an identity loss function and a triplet loss function to generate parameter optimization results. The method includes: Based on the identity loss function and the group visual enhancement features, the group identifier ID is used as the classification label to calculate the cross-entropy loss and generate identity loss parameters. Based on the triplet loss function and the group visual enhancement features, triplet samples are constructed. The triplet samples include anchor group, positive sample group and negative sample group, wherein the anchor group and the positive sample group belong to the same group, and the anchor group and the negative sample group belong to different groups. Feature analysis is performed based on the anchor point group, the positive sample group, and the negative sample group to obtain anchor point group features, positive sample group features, and negative sample group features. Calculate the Euclidean distance between the anchor point group features and the positive sample group features to generate the first group feature distance; Calculate the Euclidean distance between the anchor point group features and the negative sample group features to generate the second group feature distance; Loss analysis is performed based on the feature distance between the first group and the feature distance between the second group to obtain triplet loss parameters; The identity loss parameter is summed with the triplet loss parameter to obtain the total loss parameter for the second stage; Based on the total loss parameters of the second stage, backpropagation is performed to optimize the model parameters, generating the parameter optimization results.
Citation Information
Cited By
Small pedestrian re-identification method based on spectral domain manifold reconstruction and spatial topology cooperation
CN122265949A