A non-motor vehicle pedestrian re-identification method and system
By constructing a non-motorized vehicle and pedestrian re-identification dataset and feature fusion module, the problem of distinguishing pedestrian and non-motorized vehicle information was solved, achieving accurate identification under different cameras and adapting to changes in pedestrian movement status.
Patent Information
- Application Number
- CN202210524755.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-13
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2042-05-13
AI Technical Summary
Existing pedestrian re-identification technologies struggle to effectively distinguish between pedestrians and non-motorized vehicles when processing non-motorized pedestrians, resulting in high inter-class similarity and low intra-class similarity, making identification particularly difficult when the suspect's mode of transportation changes.
A non-motorized vehicle pedestrian re-identification dataset is constructed. A pre-trained human detector is used for human detection. By combining global and local human image features, weights are adaptively allocated through a feature fusion module. The non-motorized vehicle pedestrian re-identification network model is then used for feature extraction and recognition.
It improves the accuracy of non-motorized vehicle pedestrian re-identification and the performance of traditional pedestrian re-identification, and can effectively match the same pedestrian under different cameras, adapting to changes in pedestrian movement status.
Smart Images

Figure CN115205890B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of pedestrian re-identification, and more particularly to a method and system for re-identifying non-motorized pedestrians. Background Technology
[0002] Pedestrian re-identification refers to matching the same person under different camera views, and it is mainly used in surveillance scenarios. Currently, most existing pedestrian re-identification datasets focus on pedestrians in camera views. However, in real surveillance scenarios, pedestrians do not only walk but also engage in a large number of cycling behaviors, such as riding bicycles, electric bikes, and motorcycles. In criminal investigations, there are many cases of non-motorized vehicle theft. Therefore, identifying non-motorized vehicle pedestrians over a wide area is crucial.
[0003] To adapt to real-world scenarios, it's necessary to consider non-motorized vehicles in pedestrian re-identification. Analysis of non-motorized vehicle pedestrians reveals that they typically have a clear structure, categorized into human and non-motorized vehicle parts. Non-motorized vehicle pedestrian re-identification differs significantly from traditional pedestrian / vehicle re-identification. When different vehicles share the same model and color, they appear very similar, resulting in high inter-class similarity. Similarly, when pedestrians wear similar clothing (e.g., identical uniforms and sweatshirts), pedestrian re-identification becomes challenging. However, when non-motorized vehicles and pedestrians are combined, the information from non-motorized vehicles (e.g., model and color) is integrated with the information from pedestrians (e.g., clothing and belongings), greatly reducing intra-class similarity.
[0004] The above considers the re-identification of non-motorized vehicles and pedestrians under the same conditions. However, in criminal investigations, suspects may change their means of transportation midway through a crime, which may cause changes in the movement status of pedestrians. Therefore, pedestrian and non-motorized vehicle information also need to be considered separately.
[0005] Based on the above issues, there is an urgent need for a method and system for re-identifying non-motorized vehicles and pedestrians that simultaneously considers information about pedestrians and non-motorized vehicles. Summary of the Invention
[0006] The purpose of this section is to outline some aspects of embodiments of the present invention and to briefly describe some preferred embodiments. Simplifications or omissions may be made in this section, as well as in the abstract and title of this application, to avoid obscuring the purpose of these documents; however, such simplifications or omissions should not be construed as limiting the scope of the invention.
[0007] In view of the problems existing in the prior art, the present invention is proposed.
[0008] Therefore, the purpose of this invention is to provide a method for re-identifying non-motorized vehicles and pedestrians, which aims to better solve the problem of re-identifying non-motorized vehicles and pedestrians.
[0009] To solve the above-mentioned technical problems, the present invention provides the following technical solution: a method for re-identifying non-motorized vehicles and pedestrians, comprising the following steps:
[0010] Step 1: Construct a non-motorized vehicle and pedestrian re-identification dataset based on surveillance videos from different cameras in the same scene;
[0011] Step 2: Perform human detection on the non-motorized vehicle and pedestrian re-identification dataset based on the pre-trained human detector to obtain local human images, and preprocess the global image features and local human images.
[0012] Step 3: Use the global image features and local human images preprocessed in Step 2 to train the preset non-motorized vehicle and pedestrian re-identification network model;
[0013] Step 4: Use the trained non-motorized vehicle pedestrian re-identification network model to extract features from the target image to be identified.
[0014] As a preferred embodiment of the non-motorized vehicle pedestrian re-identification method of the present invention, the construction of the non-motorized vehicle pedestrian re-identification dataset in step one is divided into four steps:
[0015] (1) First, select surveillance videos from different cameras in the same scene, and use the online detection and tracking model TraDes to detect and track pedestrians and non-motorized vehicles in the surveillance videos to obtain target box information and trajectory information in each surveillance video;
[0016] (2) Then, a pre-trained ResNet50 deep learning network model is used to extract all detected target features;
[0017] (3) Cluster all targets using the unsupervised method infomap to associate the same target across cameras;
[0018] (4) Finally, manual calibration is performed to construct the final non-motorized pedestrian re-identification dataset.
[0019] As a preferred embodiment of the non-motorized vehicle and pedestrian re-identification method of the present invention, the non-motorized vehicle and pedestrian re-identification network model adopts three models working together, including: a global image feature extraction module, a local attention module, and a feature fusion module.
[0020] In a preferred embodiment of the non-motorized vehicle and pedestrian re-identification method of the present invention, in step four, the target image to be queried is used as the input of the non-motorized vehicle and pedestrian re-identification network model, the global image features and local human body features of the target are learned respectively, and weights are adaptively assigned to the global image features and local human body features. The global image features and local human body features are fused as the final feature descriptor of the target. The same operation steps are performed on all images in the candidate image library to obtain their feature descriptors. The cosine distance between the features of the query image and all images in the candidate library is calculated and sorted. The target with the highest similarity to the query distance is selected from the candidate library as the final recognition result.
[0021] As a preferred embodiment of the non-motorized vehicle pedestrian re-identification method of the present invention, the human detector in step two is a YOLOv5s detector. The specific preprocessing operation is as follows: the size of all original training and testing images and detected local human images are adjusted to 384×128; then, by random horizontal flipping, random erasing, random cropping and normalization of image pixel values, some occlusion and rotation samples are randomly added to enhance the training data.
[0022] As a preferred embodiment of the non-motorized vehicle pedestrian re-identification method of the present invention, the global image feature extraction module selects MGN as the basic skeleton, and the input global image is processed by MGN to obtain global image features; the local attention module includes both channel attention mechanism and spatial attention mechanism, and the input local human image is processed by the local attention module to obtain local features; the core idea of the feature fusion module is to determine the different weights of global image features and local features based on whether the input image is a bicycle, wherein if the target is a cyclist, the local features are given higher weights, and vice versa.
[0023] The global image feature extraction module uses MGN, a multi-branch deep network that combines global image features and multi-granularity local features. One branch is used to extract global image features, responsible for extracting common features. Then, the image is divided into N strips, where different N values represent different granularities, responsible for extracting features at different levels or grades. The larger N is, the finer the granularity. Two branches are used to handle multi-granularity local feature extraction. The local attention module uses a hierarchical attention network (HAN).
[0024] The feature fusion module is an adaptive attention module that determines the weights of global and local features by distinguishing the input type. The adaptive attention module also determines whether to assign greater weights to local features by judging whether the user is a cyclist.
[0025] As a preferred embodiment of the non-motorized vehicle pedestrian re-identification method of the present invention, the specific training method in step three is as follows: firstly, the global image features are... The input is fed into a simple binary classification network to obtain a B×2 feature f. w According to f w We assign weights to global image features and local human body features. If the target is a cyclist, then the local human body parts should receive higher attention. Finally, we fuse the global image features and local human body features.
[0026] F = (F g ·w1)+(F h ·w2)
[0027] Among them, F g and F h These represent global image features and local features, respectively. Feature F is ultimately used for non-motorized vehicle and pedestrian re-identification.
[0028] To improve the network's recognition capabilities, both the cross-entropy loss function for classification and the ternary loss function for metric learning were used as loss functions during the training process.
[0029] L=αL ce +βL triplet
[0030] Among them, L ce L represents the cross-entropy loss. ce The triplet loss is represented by α and β, which represent the weights of the two loss functions, respectively. The cross-entropy loss function is expressed as:
[0031]
[0032] Where N represents the minimum number of images processed in a batch, y i Representing feature F i The categories, where C represents the number of categories;
[0033] The triplet loss function uses three triplets to represent the anchor sample, negative sample, and positive sample. The anchor sample is a randomly selected sample from the training dataset. Positive samples and anchor samples belong to the same class, while negative samples and anchor samples belong to different classes. The goal of the triplet loss function is to minimize the intra-class difference within the same class and maximize the inter-class difference between different classes. Its loss function can be expressed as:
[0034]
[0035] Where α represents the edge hyperparameter, and These represent anchor point sample features, positive sample features, and negative sample features, respectively.
[0036] A method for re-identifying non-motorized vehicles and pedestrians as described above includes a sample acquisition unit, a data processing unit, a model training unit, and a model application unit.
[0037] The sample acquisition unit is used to construct a non-motorized vehicle and pedestrian re-identification dataset based on surveillance videos from different cameras in the same scene. The data processing unit is used to perform human detection on the non-motorized vehicle and pedestrian re-identification dataset based on a pre-trained human detector and to preprocess the global image and local human images. The model training unit is used to train a preset non-motorized vehicle and pedestrian re-identification network model using the preprocessed global pedestrian image and local human image. The model application unit is used to extract features from the image to be identified using the trained non-motorized vehicle and pedestrian re-identification network model.
[0038] The beneficial effects of this invention are as follows: The non-motorized vehicle pedestrian re-identification method and system proposed in this invention, considering the differences from traditional pedestrian re-identification, firstly reconstructs a non-motorized vehicle pedestrian re-identification dataset based on surveillance videos from different cameras in the same scene; then, considering the independence between non-motorized vehicles and pedestrians, a pre-trained human detector is used to perform human detection on the non-motorized vehicle pedestrian re-identification dataset to obtain local human images, and the global image and local human images are preprocessed; in order to make full use of the global image and local human images to obtain global and local features, the preprocessed global pedestrian images and local human images are used to train the non-motorized vehicle pedestrian re-identification model, and a feature fusion module is used to adaptively assign weights to global and local features. This not only helps the model to better solve the non-motorized vehicle pedestrian re-identification problem, but also helps pedestrian re-identification under traditional conditions to achieve higher performance. Attached Figure Description
[0039] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the 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. Wherein:
[0040] Figure 1 This is a flowchart illustrating a non-motorized vehicle pedestrian re-identification method proposed in this invention.
[0041] Figure 2 This is a system block diagram of a non-motorized vehicle pedestrian re-identification system proposed in this invention. Detailed Implementation
[0042] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0043] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0044] Example 1
[0045] Reference Figure 1 This is the first embodiment of the present invention, which provides a method for re-identifying non-motorized vehicles and pedestrians. This method includes the following steps:
[0046] Step 1: Construct a non-motorized vehicle and pedestrian re-identification dataset based on surveillance videos from different cameras in the same scene. The specific method is as follows:
[0047] (1) First, select surveillance videos from different cameras in the same scene, and use the online detection and tracking model TraDes to detect and track pedestrians and non-motorized vehicles in the surveillance videos to obtain target box information and trajectory information in each surveillance video;
[0048] (2) Then, a pre-trained ResNet50 deep learning network model is used to extract all detected target features;
[0049] (3) Cluster all targets using the unsupervised method infomap to associate the same target across cameras;
[0050] (4) Finally, manual calibration is performed to construct the final non-motorized pedestrian re-identification dataset;
[0051] Step 2: Based on the pre-trained human detector (YOLOv5s detector), perform human detection on the non-motorized vehicle and pedestrian re-identification dataset to obtain local human images. Preprocess the global image features and local human images by adjusting the size of all original training and testing images and the detected local human images to 384×128. Then, enhance the training data by randomly horizontally flipping, randomly erasing, randomly cropping, and normalizing the image pixel values, and by randomly adding some occluded and rotated samples.
[0052] Step 3: Use the global image features and local human images preprocessed in Step 2 to train the preset non-motorized vehicle and pedestrian re-identification network model. To improve the recognition performance of the non-motorized vehicle and pedestrian re-identification network model, the network model adopts a three-model approach for recognition. The non-motorized vehicle and pedestrian re-identification network model adopts a three-model approach for recognition, including: a global image feature extraction module, a local attention module, and a feature fusion module.
[0053] Step 4: Use the trained non-motorized vehicle and pedestrian re-identification network model to extract features from the target image. The target image is used as input to the network model, which learns both global image features and local human body features. Weights are adaptively assigned to these features, and they are fused to create the final feature descriptor. The same steps are then performed on all images in the candidate image library to obtain their feature descriptors. The cosine distance between the features of the query image and all images in the candidate library is calculated and sorted. The target with the highest similarity to the query image is selected from the candidate library as the final recognition result.
[0054] To further explain, the TraDeS tracker focuses on utilizing tracking information to aid detection and feeding the detection results back to the tracker. TraDeS is built on the point cloud-based object detection network CenterNet, primarily consisting of two models: the Correlation Model (CVA) and the Dynamic Guided Feature Bending (MFW) model. CVA constructs a cost quantity by extracting re-id embedding features point-by-point through the backbone network. This cost quantity stores similar embedding feature pairs matching two frames. Then, based on the cost quantity, a tracking offset is proposed—the temporal and spatial displacement of all points. The tracking offset integrates all features for a simple two-round long-term data association. Next, MFW uses the tracking offset as dynamic information to propagate target features from the previous frame to the current frame. Finally, the propagated features and the features of the current frame are merged for detection and segmentation. This is simply a direct application of the detection and tracking model, and therefore will not be elaborated further.
[0055] The unsupervised method InfoMap was initially used for face clustering. By accelerating the construction of adjacent edges through Faiss, it improves the clustering speed while achieving good clustering results. This is just a direct application of this clustering method, so it will not be elaborated further.
[0056] The YOLO series detectors use a classic one-stage object detection architecture. YOLOv3 consists of four parts: input, backbone, neck, and output. The backbone primarily extracts features from the input image for use by subsequent networks; the neck further processes and utilizes the key features extracted by the backbone. YOLOv4 shares the same overall architecture as YOLOv3, but incorporates many innovative integrations into its substructures. Specifically, the input employs mosaic data augmentation, cmBN, and SAT adversarial training; the backbone uses CSPDarknet53, the Mish activation function, and Dropblock; the neck uses the SPP module and FPN+PAN structure; and the output uses the same anchor box mechanism as YOLOv3, but the training loss function is CIOU_Loss, and the predicted bounding box selection NMS is DIOU_nms.
[0057] The structure of YOLOv5 is similar to YOLOv4, but there are some differences. Specifically, the input side uses Mosaic data augmentation, along with adaptive anchor box calculation and adaptive image scaling; the backbone uses a Focus structure and a CSP structure; the Neck, like YOLOv4, uses an FPN+PAN structure, but the difference is that YOLOv4's Neck structure uses ordinary convolutional operations, while YOLOv5's Neck structure uses a CSP2 structure borrowed from CSPnet, enhancing the network's feature fusion capabilities; the output side uses GIOU_Loss as the bounding box loss function. YOLOv5 has four network models: YOLOv5s, YOLOv5m, YOLOv5l, and YOLOv5x. Among them, the YOLOv5s network has the smallest depth and the smallest feature map width in the YOLOv5 series, making it the fastest. Although it loses some accuracy compared to the other three network structures, the task complexity is not very high, and the speed requirement is relatively high, so the YOLOv5s network was ultimately chosen as the human detector.
[0058] It is worth noting that the global image feature extraction module (Multi-Granularity Network) uses MGN as its basic framework. The input global image is processed by MGN to obtain global image features. The local attention module includes both channel attention and spatial attention mechanisms. The input local human image is processed by the local attention module to obtain local features. The core idea of the feature fusion module is to assign different weights to global image features and local features based on whether the input image shows a cyclist. Specifically, if the target is a cyclist, the local features are given higher weights, and vice versa. This helps the model to better solve the problem of non-motorized vehicle pedestrian re-identification, and also helps pedestrian re-identification under traditional conditions achieve higher performance.
[0059] The global image feature extraction module employs MGN, a multi-branch deep network that combines global image features with multi-granularity local features. One branch extracts global image features, responsible for extracting common features. The image is then divided into N strips, where different values of N represent different granularities, responsible for extracting features at different levels or stages. The larger the value of N, the finer the granularity. Two branches are used to extract multi-granularity local features, combining global and multi-granularity local features to obtain rich information and details to represent the input global pedestrian image. The MGN backbone uses ResNet50, divided into three branches from the latter half of the network. These three branches have similar structures but different downsampling rates. The global branch uses a convolution with stride=2 for downsampling, and global max pooling is used to generate a 2048-dimensional feature vector from the obtained feature map. This vector is then compressed into a 256-dimensional global feature vector using a 1×1 convolution. Two local branches are used to learn local feature representations. To preserve the receptive field suitable for local features, neither branch uses downsampling. One local branch uniformly divides the feature map into two strips horizontally, which can be understood as dividing the pedestrian into upper and lower body sections; the other local branch uniformly divides the feature map into three strips horizontally, which can be understood as dividing the pedestrian into upper, middle, and lower parts. The two local branches operate similarly: first, the feature map before segmentation is compressed into a 256-dimensional global feature vector through a 1×1 convolution. and After segmentation, each strip is first subjected to global pooling, followed by dimensionality reduction. Each local branch yields two 256-dimensional local feature vectors. and Another local branch yields three 256-dimensional local feature vectors. and Finally, these eight 256-dimensional features are concatenated into a single 2048-dimensional feature, which is then used as the global feature of the input global pedestrian image.
[0060] The local attention module employs a hierarchical attention network (HAN), originally used for text classification. This network features two hierarchical attention mechanisms, allowing for different levels of attention to content of varying importance. Feature maps have different channels, each representing a different meaning and thus contributing differently to the final recognition. Furthermore, different spatial locations within the feature map also possess different semantics. Therefore, HAN is used to enhance the representation of the local human image in both channel and spatial dimensions. Specifically, the local human image is processed by the first half of a ResNet50 algorithm to obtain a B×2048×24×8 feature map, where B represents the batch size. The third channel of the feature map is then segmented to obtain three feature maps X. i (i = 1, 2, 3), with dimensions B × 2048 × 8 × 8, each feature map passes through a channel attention mechanism, which includes a generalized average pooling layer, a fully connected layer for dimensionality reduction, a ReLU layer, a fully connected layer for dimensionality increase, and a sigmoid activation function. The processed feature map becomes A. i (i = 1, 2, 3). The features of channel c can be represented as follows: Spatial attention to features is achieved by enhancing the peak response.
[0061] The feature fusion module is an adaptive attention module that determines the weights of global and local features by distinguishing the input type. Furthermore, this adaptive attention module determines whether to assign greater weights to local features by judging whether the user is a cyclist.
[0062] In step three, the specific training method is as follows: First, the global image features are... The input is fed into a simple binary classification network to obtain a B×2 feature f. w According to f w We assign weights to global image features and local human body features. If the target is a cyclist, then the local human body parts should receive higher attention. Finally, we fuse the global image features and local human body features to obtain the final result.
[0063] F = (F g ·w1)+(F h ·w2)
[0064] Among them, F g and F h These represent global image features and local features, respectively. Feature F is ultimately used for non-motorized vehicle and pedestrian re-identification.
[0065] To improve the network's recognition capabilities, both cross-entropy loss (used for classification) and triplet loss (used for metric learning) were employed as loss functions during the training process.
[0066] L=αL ce +βL triplet
[0067] Among them, L ce L represents the cross-entropy loss. ce The triplet loss is represented by α and β, which represent the weights of the two loss functions, respectively. The cross-entropy loss function is expressed as:
[0068]
[0069] Where N represents the minimum number of images processed in a batch, y i Representing feature F i The categories, where C represents the number of categories;
[0070] The triplet loss function uses three terms: anchor, negative, and positive. The anchor is a randomly selected sample from the training dataset. Positive and anchor samples belong to the same class, while negative and anchor samples belong to different classes. The goal of the triplet loss function is to minimize the intra-class difference within the same class and maximize the inter-class difference between different classes. The loss function can be expressed as:
[0071]
[0072] Where α represents the edge hyperparameter, and These represent anchor point sample features, positive sample features, and negative sample features, respectively.
[0073] Example 2
[0074] Reference Figure 2 This is the second embodiment of the present invention, which differs from the first embodiment in that it is a system for a non-motorized vehicle pedestrian re-identification method used in the above embodiments.
[0075] The system includes: a sample acquisition unit, a data processing unit, a model training unit, and a model application unit;
[0076] The sample acquisition unit is used to construct a non-motorized vehicle and pedestrian re-identification dataset based on surveillance videos from different cameras in the same scene. The data processing unit is used to perform human detection on the non-motorized vehicle and pedestrian re-identification dataset based on a pre-trained human detector and to preprocess the global image and local human images. The model training unit is used to train a preset non-motorized vehicle and pedestrian re-identification network model using the preprocessed global pedestrian image and local human image. The model application unit is used to extract features from the image to be identified using the trained non-motorized vehicle and pedestrian re-identification network model.
[0077] The proposed non-motorized vehicle pedestrian re-identification method and system in this invention, considering the differences from traditional pedestrian re-identification, firstly reconstructs a non-motorized vehicle pedestrian re-identification dataset based on surveillance videos from different cameras in the same scene; then, considering the independence between non-motorized vehicles and pedestrians, a pre-trained human detector is used to perform human detection on the non-motorized vehicle pedestrian re-identification dataset to obtain local human images, and the global image and local human images are preprocessed; in order to fully utilize the global image and local human images to obtain global and local features, the preprocessed global pedestrian images and local human images are used to train the non-motorized vehicle pedestrian re-identification model, and a feature fusion module is used to adaptively assign weights to global and local features. This not only helps the model to better solve the non-motorized vehicle pedestrian re-identification problem, but also helps pedestrian re-identification under traditional conditions achieve higher performance.
[0078] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A method for re-identifying non-motorized vehicles and pedestrians, characterized in that: Includes the following steps, Step 1: Construct a non-motorized vehicle and pedestrian re-identification dataset based on surveillance videos from different cameras in the same scene; Step 2: Perform human detection on the non-motorized vehicle and pedestrian re-identification dataset based on the pre-trained human detector to obtain local human images, and preprocess the global image features and local human images. Step 3: Use the global image features and local human images preprocessed in Step 2 to train the preset non-motorized vehicle and pedestrian re-identification network model; Step 4: Use the trained non-motorized vehicle and pedestrian re-identification network model to extract features from the target image to be identified; The specific training method in step three is as follows: First, the global image features are... The input is fed into a simple binary classification network to obtain a B×2 feature f. w According to f w We assign weights to global image features and local human body features. If the target is a cyclist, then the local human body parts should receive higher attention. Finally, we fuse the global image features and local human body features. F=(F g ·w1)+(F h ·w2) Among them, F g and F h These represent global image features and local features, respectively. Feature F is ultimately used for non-motorized vehicle and pedestrian re-identification. To improve the network's recognition capabilities, both the cross-entropy loss function for classification and the ternary loss function for metric learning were used as loss functions during the training process. L=αL ce +βL triplet Among them, L ce L represents the cross-entropy loss. ce The triplet loss is represented by α and β, which represent the weights of the two loss functions, respectively. The cross-entropy loss function is expressed as: Where N represents the minimum number of images processed in a batch, y i Representing feature F i The categories, where C represents the number of categories; The triplet loss function uses three triplets to represent the anchor sample, negative sample, and positive sample. The anchor sample is a randomly selected sample from the training dataset. Positive samples and anchor samples belong to the same class, while negative samples and anchor samples belong to different classes. The goal of the triplet loss function is to minimize the intra-class difference within the same class and maximize the inter-class difference between different classes. Its loss function can be expressed as: Where α represents the edge hyperparameter, and These represent anchor point sample features, positive sample features, and negative sample features, respectively.
2. The non-motorized vehicle and pedestrian re-identification method according to claim 1, characterized in that: In step one, constructing the non-motorized vehicle and pedestrian re-identification dataset involves four steps: (1) First, select surveillance videos from different cameras in the same scene, and use the online detection and tracking model TraDes to detect and track pedestrians and non-motorized vehicles in the surveillance videos to obtain target box information and trajectory information in each surveillance video; (2) Then, a pre-trained ResNet50 deep learning network model is used to extract all detected target features; (3) Cluster all targets using the unsupervised method infomap to associate the same target across cameras; (4) Finally, manual calibration is performed to construct the final non-motorized pedestrian re-identification dataset.
3. The non-motorized vehicle and pedestrian re-identification method according to claim 2, characterized in that: The non-motorized vehicle pedestrian re-identification network model employs three models working together: a global image feature extraction module, a local attention module, and a feature fusion module.
4. The non-motorized vehicle and pedestrian re-identification method according to claim 3, characterized in that: In step four, the target image to be queried is used as input to the non-motorized vehicle and pedestrian re-identification network model. The model learns the global image features and local human body features of the target, adaptively assigning weights to these features. The global image features and local human body features are then fused to obtain the final feature descriptor for the target. The same operation is performed on all images in the candidate image library to obtain their feature descriptors. Calculate the cosine distance between the features of the query image and all images in the candidate database, sort the distances, and select the target with the highest distance similarity to the query image from the candidate database as the final recognition result.
5. The non-motorized vehicle and pedestrian re-identification method according to any one of claims 1 to 4, characterized in that: The human detector in step two is the YOLOv5s detector. The specific preprocessing operations are as follows: the size of all original training and testing images and detected local human images are adjusted to 384×128; then, by randomly horizontally flipping, randomly erasing, randomly cropping, and normalizing the image pixel values, some occlusion and rotation samples are randomly added to enhance the training data.
6. The non-motorized vehicle and pedestrian re-identification method according to claim 3, characterized in that: The global image feature extraction module selects MGN as the basic skeleton, and the input global image is processed by MGN to obtain global image features; the local attention module includes both channel attention mechanism and spatial attention mechanism, and the input local human image is processed by the local attention module to obtain local features. The core idea of the feature fusion module is to assign different weights to global image features and local features based on whether the input image is a bicycle. Specifically, if the target is a cyclist, the local features are given higher weights, and vice versa. The global image feature extraction module uses MGN, a multi-branch deep network that combines global image features and multi-granularity local features. One branch is used to extract global image features, responsible for extracting common features. Then, the image is divided into N strips, where different N values represent different granularities, responsible for extracting features at different levels or grades. The larger N is, the finer the granularity. Two branches are used to handle multi-granularity local feature extraction. The local attention module uses a hierarchical attention network (HAN). The feature fusion module is an adaptive attention module that determines the weights of global and local features by distinguishing the input type. The adaptive attention module also determines whether to assign greater weights to local features by judging whether the user is a cyclist.
7. A system applied to the non-motorized vehicle and pedestrian re-identification method according to claim 6, characterized in that: The system includes: a sample acquisition unit, a data processing unit, a model training unit, and a model application unit; The sample acquisition unit is used to construct a non-motorized vehicle and pedestrian re-identification dataset based on surveillance videos from different cameras in the same scene. The data processing unit is used to perform human detection on the non-motorized vehicle and pedestrian re-identification dataset based on a pre-trained human detector and to preprocess the global image and local human images. The model training unit is used to train a preset non-motorized vehicle and pedestrian re-identification network model using the preprocessed global pedestrian image and local human image. The model application unit is used to extract features from the image to be identified using the trained non-motorized vehicle and pedestrian re-identification network model.