GPAVLPD global self-adaption-based cross-modal single-stage pedestrian detection method

Through the GPA_VLPD method, the CLIP model and extremely simplified channel and spatial attention modules are used to solve the problem of difficulty in balancing accuracy and speed in pedestrian detection in complex environments, and achieve efficient pedestrian detection, which is suitable for autonomous driving and video surveillance.

CN118823830AActive Publication Date: 2024-10-22XIAMEN UNIV TAN KAH KEE COLLEGE +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410887980.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-03
Publication Date
2024-10-22
Estimated Expiration
2044-07-03

AI Technical Summary

Technical Problem

Existing pedestrian detection algorithms have difficulty balancing detection accuracy and reasoning speed in complex environments. In particular, the detection speed of the two-stage method is limited, and the accuracy of the single-stage method is much lower than that of the two-stage method.

Method used

A globally adaptive cross-modal single-stage pedestrian detection method based on GPA_VLPD is proposed. The pre-trained visual language model CLIP is used to fuse image and text features, and the minimalist channel and spatial attention module (GPA) are combined for feature extraction and enhancement. The feature extraction and discrimination capabilities of the detector improve detection accuracy and maintain inference speed.

Benefits of technology

It achieves fast and accurate pedestrian detection in complex environments. The detection accuracy is equivalent to that of the two-stage method, and the inference speed is maintained at the level of the single-stage method. It is suitable for fields such as autonomous driving and video surveillance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118823830A_ABST
    Figure CN118823830A_ABST
Patent Text Reader

Abstract

The invention provides a cross-modal single-stage pedestrian detection method based on GPAVLPD global self-adaption. The method comprises the following steps: mapping a category text into a text feature by using a Text Encoder of a pre-trained visual language model CLIP; a pseudo tag is obtained through an Image Encoder of the CLIP; then inputting the training set and the text features into a GPA-VLPD feature extraction module to obtain a GPA-VLPD model suitable for pedestrian detection; and finally, performing reasoning detection on the image by using the trained model. And if the pedestrian is detected, frame selection and output are carried out.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical fields of machine vision, automatic driving and pedestrian video monitoring, and in particular to a cross-modal single-stage pedestrian detection method based on GPA_VLPD global adaptation. Background Art

[0002] Pedestrian detection is a popular task in computer vision. It aims to quickly classify and locate pedestrians in images or videos in complex and changing environments. In today's increasingly intelligent life, many applications rely on pedestrian detection, such as pedestrian search, action recognition, and video surveillance. Especially for autonomous driving, smart vehicles need to quickly detect pedestrians and respond, otherwise the lives of pedestrians may be threatened. Therefore, the inference speed and detection accuracy of pedestrian detection algorithms are very important.

[0003] There are two main difficulties in pedestrian detection: pedestrians can be affected by non-human objects or nearby pedestrians in complex street environments, resulting in intra-class or inter-class occlusions. Pedestrians in different directions and at longer distances will produce small targets in the monitor that are very different from normal target scales. These two difficulties greatly destroy the general regular shape of pedestrians and reduce the distinguishing features. The most challenging is the Heavy detection set where the two difficulties are added together. Pedestrians are severely occluded and the target scale is very small. Its features are compact and fuzzy, lacking sufficient details. In this case, human-shaped occluders are very similar to pedestrians in morphology, which can easily cause the detector to misdetect, further increasing the difficulty of pedestrian detection. Therefore, dealing with these problems requires the detector to have strong feature extraction capabilities and the ability to distinguish and detect pedestrians under complex conditions.

[0004] In order to solve the above problems, the two-stage method based on Faster R-CNN and Cascade Mask R-CNN has been widely used in various pedestrian detection tasks due to its excellent feature extraction and processing capabilities. The two-stage method usually uses HRNet or ResNeXt as the backbone extraction network, and then uses the feature information extracted by the backbone to roughly predict possible targets through the region proposal network (RPN), and then strictly refines the feature bounding box in the proposed area and generates the final prediction score. There is also F2DNet that uses a fast suppression head to help solve the false positives produced by the detection head. In addition to the common two-stage target detection methods, there are also pedestrian detection using unique features of human targets (such as human key points and masks of visible parts). However, since the reasoning speed of these methods is limited by their network architecture, they are not easy to use in real life.

[0005] In order to simplify the network structure and speed up the reasoning speed, the researchers developed a single-stage method that only performs one round of prediction and successfully applied it to pedestrian detection. However, the accuracy of the single-stage method in each test subset is much lower than that of the two-stage method F2DNet. The single-stage method has an advantage in reasoning speed, but it cannot take into account the detection accuracy. To alleviate this problem, VLPD improves the overall architecture of CSP and introduces the pre-trained visual semantic model CLIP to obtain additional visual semantic labels through pseudo labels mapped across modalities to identify the semantic classes of display contexts. In the training stage, the prototype semantic contrast learning method is used to assist the network to better distinguish between pedestrians and contexts. VLPD has achieved good improvements in accuracy on each test subset of Citypersons. However, compared with the two-stage method F2DNet, VLPD still has room for improvement in detection accuracy. Summary of the invention

[0006] Considering the complexity and diversity of the detection environment and detection targets, pedestrian detection is a difficult problem to solve, and it also takes into account detection accuracy and detection speed. Current pedestrian detection is mainly divided into two-stage methods and single-stage methods. The two-stage method achieves leading detection accuracy by additionally utilizing the method of generating and selecting candidate bounding boxes, but its detection speed is also suppressed. The single-stage method directly predicts on the extracted feature map, which greatly improves the detection speed, but its detection accuracy is far inferior to the two-stage method. The present invention aims to improve the pedestrian detection accuracy of the single-stage method to a level comparable to that of the two-stage method while maintaining the single-stage detection speed, redesign the feature extraction module of VLPD, add the newly designed lightweight module GPA, and propose the GPA-VLPD algorithm to achieve fast and accurate identification and positioning of pedestrians in complex environments. Through the present invention, the single-stage pedestrian detection method can be better applied to real life, promoting progress in fields such as autonomous driving and video surveillance.

[0007] The specific technical solutions are as follows:

[0008] A cross-modal single-stage pedestrian detection method based on GPA_VLPD global adaptation: the category text is mapped to text features using the Text Encoder of the pre-trained visual language model CLIP; pseudo labels are obtained through the Image Encoder of CLIP; the training set and text features are then input into the GPA-VLPD feature extraction module to obtain a GPA-VLPD model suitable for detecting pedestrians; finally, the trained model is used to perform inference detection on the image; if a pedestrian is detected, it is boxed and output.

[0009] Furthermore, before training begins, the categories in pedestrian detection are mapped to text feature vectors of specified size using the Text Encoder of the CLIP model according to the template and category; the generated text feature vectors are calculated with the image features for cosine similarity through dot product, thereby achieving cross-modal fusion of image and text.

[0010] Furthermore, the GPA-VLPD feature extraction module includes a simplified channel and spatial attention module GPA, which is used to adaptively refine the feature map, and obtain channel weights and spatial weights using a structure in which channel attention and spatial attention are calculated in parallel. The channel weights are used to adjust the feature responses of each channel, and the spatial weights are used to adjust the feature responses of different spatial positions; then the channel weights and spatial weights are fused in an additive reactivation manner to obtain a unified 3D attention map; finally, the attention map and the input feature are multiplied pixel by pixel to achieve adaptive feature adjustment in both channel and space.

[0011] Furthermore, in the simplified channel and spatial attention module GPA:

[0012] For channel attention:

[0013] A ch (X) = F ex (F sq ,W)=σ[W 2 δ(W 1 (F GP (x)))]

[0014] Use global average pooling F GP Compress the spatial information of the global feature map into a one-dimensional vector of size C×1×1: This vector represents the global importance of the channel feature; this vector is directly forwarded to a shared network with two fully connected layers and one hidden layer, and the reduction rate r of the dimension reduction layer is set to 16; the shared network is used to learn how to weight the feature response of each channel; after being processed by the shared network, in order to add the spatial features pixel by pixel, the feature vector is expanded to the input feature size using the σ(·) tensor expansion function to obtain the channel feature vector A ch (X);

[0015] For spatial attention:

[0016] A sp (X) = σ(W([F avg (X); F max(X)]))

[0017] First, taking the channel of the feature as the axis, the input feature is globally averaged and max-pooled to obtain two 2D spatial attention features, and then the two generated spatial attention features are concat to generate a spatial attention map; A convolution operation with a convolution kernel of 7×7 is performed to reduce parameters and calculation amount; finally, the generated 2D spatial attention map is expanded to the input feature size using the expansion function to obtain the spatial feature vector A sp (X);

[0018] Spatial channel fusion: The outputs of the channel branch and the spatial branch are synthesized in a parallel layout

[0019] GMA(X)=Z⊙X=(F SG (A ch +A sp ))⊙X

[0020] ″+″ means adding the channel feature weight and the spatial feature weight pixel by pixel to achieve the weighted fusion of channel information and spatial information; F SG is the activation function Sigmoid, which limits the output between 0 and 1, indicating the weight of each position; "⊙" is the pixel-by-pixel multiplication of the feature map and the 3D attention map.

[0021] Furthermore, in the GPA-VLPD feature extraction module, VLPD uses ResNet-50 as the backbone and initializes the weights of the pre-trained visual language model CLIP; VLPD does not perform downsampling in Stage 5, but uses dilated convolution to increase the receptive field, and adds SE-POSTblock to each layer of the last Stage of ResNet-50;

[0022] The minimalist channel and the spatial attention module GPA are added after the p3 and p4 output layers of VLPD to form a GPA-VLPD feature extraction module.

[0023] Furthermore, in the training phase, the overall network architecture of the GPA-VLPD feature extraction module is:

[0024] The first part is the feature extraction module plus the CSP detection head. First, the trunk is initialized using the CLIP-ResNet50 pre-trained weights. Then, the input image is feature extracted and the feature vector output by the last layer of the trunk is fused with the text vector generated by CLIP. The p3, p4, and p5 of the trunk are uniformly deconvolved to the same size and spliced. The feature vectors that fuse the image and text information are upsampled and spliced ​​together. Finally, the CSP detection head performs inference and prediction directly on the feature map containing visual semantic information.

[0025] The second part is to conduct unsupervised comparative learning between the p5 feature map that incorporates semantic information and the feature map generated by CLIP Image-Encoder that also incorporates semantic information;

[0026] The third part is to perform prototype semantic comparative learning on the feature map after p3 deconvolution with the annotation box and the p5 feature map that integrates semantic information, bringing objects of the same category closer and moving objects of different categories farther away, thereby improving the model's ability to distinguish pedestrians and the environment.

[0027] Furthermore, in the inference stage, the GPA-VLPD feature extraction module only retains the first part and the corresponding weights obtained through training.

[0028] Furthermore, the dataset used for training is constructed as follows: first, the Citypersons high-resolution dataset is divided into a training set and a test set; the training set is randomly cropped to the same size and a label file of the corresponding position is generated; and then the training set is subjected to data augmentation operations such as random brightness change and random flipping.

[0029] And,. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of a cross-modal single-stage pedestrian detection method based on GPA_VLPD global adaptation as described above are implemented.

[0030] A non-transitory computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a cross-modal single-stage pedestrian detection method based on GPA_VLPD global adaptation as described above.

[0031] Compared with the prior art, the GPA-VLPD proposed in the present invention and its preferred embodiment, which has the detection accuracy of a two-stage pedestrian detection method and the inference speed of a single-stage pedestrian detection method, is more suitable for application in real life to promote progress in the fields of autonomous driving and pedestrian video surveillance. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments:

[0033] Figure 1 It is a schematic diagram of templates and categories of embodiments of the present invention;

[0034] Figure 2 This is a schematic diagram of a GPA module according to an embodiment of the present invention;

[0035] Figure 3 This is a schematic diagram of the SE-POST module according to an embodiment of the present invention;

[0036] Figure 4 This is a schematic diagram of a GPA-VLPD feature extraction module according to an embodiment of the present invention;

[0037] Figure 5 This is a schematic diagram of the GPA-VLPD network architecture according to an embodiment of the present invention;

[0038] Figure 6 , Figure 7 , Figure 8 Three randomly selected images from the test set;

[0039] Fig. 9 The folder structure for storing the training set and the test set in the embodiment of the present invention;

[0040] Fig.10 , Fig.11 This is a diagram showing the detection results of a pedestrian test set under different conditions according to an embodiment of the present invention;

[0041] Fig.12 , Fig.13 , Fig.14 Corresponding to Figure 6 , Figure 7 , Figure 8 Detection result diagram. DETAILED DESCRIPTION

[0042] Hereinafter, the specific embodiments of the present application will be described in detail with reference to the accompanying drawings. According to these detailed descriptions, those skilled in the art can clearly understand the present application and can implement the present application. Without violating the principles of the present application, the features in the various embodiments can be combined to obtain new implementations, or certain features in certain embodiments can be replaced to obtain other preferred implementations.

[0043] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.

[0044] In order to make the features and advantages of this patent more obvious and easy to understand, the following embodiments are specifically cited and explained in detail as follows: The detection scheme provided by the embodiment of the present invention is divided into four steps: image preprocessing, using CLIP to obtain visual features and semantic features, model training, and pedestrian detection.

[0045] First, the Citypersons high-resolution dataset (1024×2048) is divided into a training set and a test set. In order to save training time and computing resources, the training set is randomly cropped to the same size (640×1024) and the label file of the corresponding position is generated. In order to enhance the robustness of the model, the training set is subjected to data augmentation operations such as random brightness change and random flipping. Then, the category text is mapped to text features using the Text Encoder of the pre-trained visual language model CLIP. The pseudo label is obtained using the Image Encoder of CLIP. The training set and text features are then input into the GPA-VLPD network to obtain the GPA-VLPD model suitable for detecting pedestrians. Finally, the model is used to perform inference detection on the Citypersons test set. If a pedestrian is detected, the pedestrian is selected with a green box and output. If there is no pedestrian, the result image that is the same as the input image is output.

[0046] The following are the main technical details of this solution:

[0047] 1. Cross-modal data processing

[0048] CLIP is a multimodal model based on contrastive learning. Benefiting from its large text-image pair training set, CLIP has a strong zero-shot classification capability. Therefore, before training begins, according to the template and category, the CLIP model's Text Encoder is used to map the categories in pedestrian detection to a text feature vector of size 1024×10 (10 is the number of categories). Figure 1 The specific composition of the template and category before text mapping and the pre-trained weights of CLIP are shown. The generated text feature vector is calculated with the image feature through the dot product method to calculate the cosine similarity, thereby realizing the cross-modal fusion of image and text, which is conducive to improving the category discrimination ability of the backbone.

[0049] 2. GPA module principle

[0050] The present invention proposes a simplified channel and spatial attention module (GPA), such as Figure 2 As shown in the figure, the feature map is adaptively refined. Inspired by BAM, CBAM and Polarized Self-Attention, GPA uses the structure of parallel calculation of channel attention and spatial attention to obtain channel weights and spatial weights. The channel weights are used to adjust the feature response of each channel, enhance useful information and reduce noise. The spatial weights are used to adjust the feature responses of different spatial positions and improve the sensitivity to important areas. Then the channel weights and spatial weights are fused in an additive reactivation manner to obtain a unified 3Dattention map. Finally, the attention map and the input feature are multiplied pixel by pixel to achieve adaptive feature adjustment in both channels and space.

[0051] For channel attention:

[0052] A ch (X) = F ex (F sq ,W)=σ[W 2 δ(W 1 (F GP (X)))]

[0053] In order to alleviate channel dependence and enhance the ability of channel units to utilize out-of-region context, global average pooling F is used. GP Compress the spatial information of the global feature map into a one-dimensional vector of size (C×1×1): This vector represents the global importance of the channel feature. In order to reduce the complexity of the model and reduce parameter overhead, this vector is directly forwarded to the shared network with two fully connected layers and one hidden layer, and the reduction rate r of the dimension reduction layer is set to 16 with reference to SE attention. The shared network is used to learn how to weight the feature response of each channel. After being processed by the shared network, in order to add the spatial features pixel by pixel, the feature vector is expanded to the input feature size using the σ(·) tensor expansion function to obtain the channel feature vector A ch (X).

[0054] For spatial attention:

[0055] In order to strengthen the spatial connection between input features, we first use the channel of the feature as the axis, perform global average pooling and maximum pooling on the input features to obtain two 2D spatial attention features, and then concat the two generated spatial attention features to generate a spatial attention map. Through a convolution operation with a convolution kernel of 7×7, the parameters and calculation amount are greatly reduced, which is conducive to establishing high-dimensional spatial feature correlation. Finally, the generated 2D spatial attention map is expanded to the input feature size using the expansion function to obtain the spatial feature vector A sp (X).

[0056] A sp (X) = σ(W([F avg (X); F max (X)]))

[0057] Spatial channel fusion: The outputs of the above channel branch and spatial branch are synthesized in a parallel layout

[0058] GMA(X)=Z⊙X=(F SG (A ch +A sp ))⊙X

[0059] "+" means adding the channel feature weight and the spatial feature weight pixel by pixel to achieve the weighted fusion of channel information and spatial information. SG is the activation function Sigmoid, which limits the output between 0 and 1 through the activation function, indicating the weight of each position, and also adds nonlinearity to the weight feature vector that integrates channel information and spatial information, so that it can better fit the input features. "⊙" is to multiply the feature map by the 3D attention map pixel by pixel, which greatly improves the connection between each feature in the channel and space, and is more conducive to extracting effective features of the target.

[0060] 3. GPA-VLPD feature extraction module

[0061] VLPD selects the classic ResNet-50 as the backbone and initializes the weights of the pre-trained visual language model CLIP. ResNet-50 has a simple structure and fast inference speed, but it is still slightly inferior to backbones such as HRNetv2 in feature extraction capabilities. At the same time, in order to reduce the loss of feature information during downsampling, VLPD does not perform downsampling in Stage 5.

[0062] In order to make up for the loss of receptive field caused by no downsampling, VLPD uses dilated convolution in Stage 5 to increase the receptive field, which also limits the expressive power of the backbone to a certain extent. Inspired by BoTNet and SENet, Figure 3As shown in the figure, GPA-VLPD adds SE-POSTblock to each layer of the last stage of ResNet-50. With a small increase in the number of parameters and calculations, it can better explore the relationship between channels, adaptively adjust channel information, and improve backbone performance. GPA-VLPD keeps the overall backbone architecture basically unchanged, and the original training formula of VLPD and CLIP initialization weights are still applicable, which effectively improves the problem of insufficient backbone capacity in VLPD.

[0063] By comparing the experimental results of VLPD with the two-stage method F2DNet, we found that VLPD is slightly insufficient in detecting heavily occluded targets in complex environments. VLPD reduces the missrate of the Heavy occlusion subset by 1.62% by adding the Prototype Semantic Contrast (PSC) module during training, but we believe that this is not the limit of the PSC module, so we further explore the PSC module. In the experiment, we found that Figure 4 , the PSC feature input is Modified to After that, although the missrate of other test subsets increased, the missrate of the Heavy occlusion subset decreased by 0.11, and because the PSC input size was reduced from (768, 160, 320) to (256, 160, 320) (H and W were 640 and 1280 respectively during training), the amount of calculation during training was reduced, which was more friendly to the training hardware conditions. In order to make up for the lack of semantic information of PSC with only one feature layer and continue to improve the detector's detection ability for severely occluded targets, a GPA module with global adaptive capabilities was added after the output layer of the feature extraction module p3 and p4. Through the above series of operations, the feature extraction module of GPA-VLPD was finally formed.

[0064] 4. Overall network architecture and process

[0065] During the training phase, the overall network architecture is divided into three parts. Figure 4 and Figure 5As shown in the figure, the first part is the feature extraction module plus the CSP detection head. This part first uses the CLIP-ResNet50 pre-trained weights to initialize the backbone, then extracts features from the input image, and fuses the feature vector output by the last layer of the backbone with the text vector generated by CLIP. In order to obtain multi-scale information and better detect pedestrians of different sizes, the p3, p4, and p5 of the backbone are uniformly deconvolved to the same size and spliced, and the feature vectors that fuse image and text information are upsampled and spliced ​​together. Finally, the CSP detection head directly performs inference and prediction on the feature map containing visual semantic information. The second part is to perform unsupervised comparative learning on the p5 feature map that fuses semantic information and the feature map generated by CLIP Image-Encoder that also fuses semantic information, so as to improve the learning ability of the feature extraction module. The third part is to perform prototype semantic comparative learning on the feature map after p3 deconvolution with the annotation box and the p5 feature map that fuses semantic information, so as to bring the objects of the same category closer and keep the objects of different categories farther away, thereby improving the model's ability to distinguish pedestrians and the environment. In the inference phase, only the first part needs to be retained, so although it takes more time to train, it does not affect the speed of the model during inference. In fact, this model is very suitable for transfer learning, because in actual application, only the weights of the first part need to be retained, and the additional generated text features only need to be generated and saved before inference, which does not affect the inference speed of the network.

[0066] The computer experimental environment used in this example is as follows: Ubuntu: 20.04, CPU: Inter(R) Xeon(R) Gold 6326CPU@2.90HGz, GPU: GeForce GTX 4090, Memory: 128G, Python: 3.8.10, Pytorch: 1.10.0

[0067] 1. Dataset creation

[0068] The Citypersons dataset is a dataset specially built in the field of pedestrian detection based on the CityScapes dataset. It selects 5,000 high-quality images from CityScapes and annotates the pedestrians in them with bounding boxes. The dataset records 19,654 people in 18 different cities under different weather conditions, with an average of 7 pedestrians per image. The training set of the dataset contains 2,975 images and the test set contains 500 images. The image download address is: https: / / www.cityscapes-dataset.com / , the annotation file download address is: https: / / github.com / cvgroup-njust / CityPersons / tree / master / annotations, and the CLIP pre-trained weight download address is: https: / / openaipublic.azureedge.net / clip / models.

[0069] All dataset images are in .png format with a size of 1024×2048. Figure 6 , Figure 7 and Figure 8 These are three randomly selected images from the test set.

[0070] In this method, all training images are resized to 640×1024 before being sent to the model training, and data enhancements such as random cropping, flipping, and lighting changes are performed to improve the robustness of the model. The folder structure for storing the training set and test set is as follows: Fig. 9 As shown:

[0071] 2. Define training hyperparameters and evaluation metrics

[0072] In this network, in order to compare fairly with other single-stage pedestrian detection methods, the hyperparameter settings are kept consistent. The main hyperparameters are as follows: Initial learning rate: 2e-4, BatchSize: 4, epoch: 200, lr_policy: step, λ 1 : 100, λ 2 :1e-3. The specific and complete hyperparameter download address is: https: / / github.com / lmy98129 / VLPD / blob / -main / config.py.

[0073] MR -2By adjusting different detection confidence thresholds, we can obtain different relationships between log(MR) and FPPI (MR=1-Recall, FPPI=FP / N). In the curve with FPPI as the horizontal axis and log(MR) as the vertical axis, we evenly select 9 FPPIs in the range of [0.01,100] to obtain their corresponding 9 log(MR) values, and average these vertical axis values. Finally, we use exponential operation to restore the above average value to the percentage form of MR, thus obtaining the MR used to quantify the MR-FPPI curve. -2 The smaller the index is, the higher the performance of the detector is.

[0074] In order to more accurately evaluate the ability of GAP-VLPD to detect pedestrians in various complex situations, various test subsets are tested. The definition of different test subsets is divided by the height and visibility of pedestrians in the image, as shown in Table 1 and Table 2:

[0075] Table 1

[0076] SubSet Reasonable Small HO ALL Height [50,inf] [50,75] [50,inf] [20,inf] Visibility [0.65,inf] [0.65,inf] [0.2,0.65] [0.2.inf]

[0077] Table 2

[0078] SubSet Hea. Partial Bare R+HO Height [50,inf] [50,inf] [50,inf] [20,inf] Visibility [0,0.65] [0.65,0.9] [0.9,1] [0.2,1]

[0079] 3. Model training

[0080] After defining various parameters, start training the model. The training command is as follows:

[0081] CUDA_VISIBLE_DEVICES=0,1python-mtorch.distributed.launch--nproc_per_node2--master_port45622trainval_distributed.py

[0082] The following data will be output during training:

[0083] Epoch1beginEpoch1end,AvgLossis0.015213,Timeused281.0sec.

[0084] Epoch1haslowestloss:0.0152127

[0085] ----------Epoch2begin

[0086] [Epoch2 / 300,Batch80 / 500]$<Totalloss:0.014988> cls:0.001920,reg:0.000329,off:0.005166,ps:0.753704,pc:0.035747,Time:0.566,lr:0.000133

[0087] Where cls, reg and off are the category loss, regression loss and position offset loss generated by the CSP detection head respectively. Figure 4 As shown, ps is the unsupervised contrastive learning loss pc is the prototype semantic contrastive learning loss Total loss calculation function for:

[0088]

[0089] After each epoch, the average loss and minimum loss of the epoch and the time taken are calculated. If the loss of this epoch is the lowest, the parameters of the current model are saved as best.pt. The total training time is 15.6h.

[0090] 4. Model Testing

[0091] After the training is completed, the pedestrian test set under different conditions is tested according to the saved best.pt. The test results are as follows: Fig.10 and Fig.11 As shown in the figure, GPA-VLPD has a lower miss-rate than the two-stage method F2DNet on each test subset. This shows that GPA-VLPD has strong feature extraction capabilities and the ability to identify pedestrians in complex environments. At the same time, the FPS of GPA-VLPD is 11.5, which maintains the reasoning speed of the single-stage pedestrian detection method. GPA-VLPD, which takes into account both detection accuracy and reasoning speed, is more suitable for application in real life.

[0092] Fig.12 , Fig.13 and Fig.14 They are Figure 6 , Figure 7 and Figure 8 The reasoning detection results show that GPA-VLPD is very accurate in pedestrian detection through the output green detection box. It can also identify pedestrians that are mostly blocked by power poles and vehicles.

[0093] The existing two-stage pedestrian detection method F2DNet performs better in detection accuracy on various test subsets than the single-stage pedestrian detection method VLPD. The missrate of F2DNet on the Reasonable and HO test subsets are 8.7 and 32.6, respectively, which are significantly better than VLPD's 9.4 and 34.88. However, in real applications, pedestrian detection methods require both detection accuracy and reasoning speed. The FPS of F2DNet 2.27 is much lower than the FPS of VLPD 11.7, so a pedestrian detection model with a more balanced detection accuracy and reasoning speed is needed. GPA-VLPD reconstructs the feature extraction module of VLPD and adds the simplified channel and spatial attention module GPA, achieving a miss rate of 8.69 and 32.47 on the Reasonable and HO test subsets at an FPS of 11.5. The detection accuracy of GPA-VLPD is comparable to that of F2DNet. Even on the Small test subset, the miss rate of GPA-VLPD can reach 10.54, which is ahead of F2DNet's 11.3, and it also has a detection speed similar to that of VLPD. Therefore, GPA-VLPD has the advantages of fast reasoning speed and high detection accuracy. GPA-VLPD performs well on various test subsets, especially on the small target test subset and the severe occlusion test subset, the miss rate is reduced by 0.4% and 2.4% compared with VLPD, so GPA-VLPD is more robust in complex detection environments and can better distinguish small target pedestrians and occluders. In summary, the GPA-VLPD proposed in the present invention, which has the detection accuracy of the two-stage pedestrian detection method and the reasoning speed of the single-stage pedestrian detection method, is more suitable for application in real life, and promotes progress in the fields of autonomous driving and pedestrian video surveillance.

[0094] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0095] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0096] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0097] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0098] The above is only a preferred embodiment of the present invention, and does not limit the present invention in other forms. Any technician familiar with the profession may use the above disclosed technical content to change or modify it into an equivalent embodiment with equivalent changes. However, any simple modification, equivalent change and modification made to the above embodiment according to the technical essence of the present invention without departing from the technical solution of the present invention still belongs to the protection scope of the technical solution of the present invention.

[0099] This patent is not limited to the above-mentioned optimal implementation mode. Anyone can derive other forms of a cross-modal single-stage pedestrian detection method based on GPA_VLPD global adaptation under the inspiration of this patent. All equal changes and modifications made according to the scope of the patent application of the present invention should be covered by this patent.

Claims

1. A cross-modal single-stage pedestrian detection method based on GPA_VLPD global adaptation, characterized by: The pre-trained visual language model CLIP’s Text Encoder is used to map the category text into text features. The pseudo-label is obtained through CLIP’s Image Encoder. The training set and text features are then input into the GPA-VLPD feature extraction module to obtain a GPA-VLPD model suitable for detecting pedestrians. Finally, the trained model is used to perform inference detection on the image. If a pedestrian is detected, it is boxed and output.

2. According to claim 1, a GPA_VLPD global adaptive cross-modal single-stage pedestrian detection method is characterized by: Before training begins, the categories in pedestrian detection are mapped to text feature vectors of specified size using the Text Encoder of the CLIP model according to the template and category. The generated text feature vectors are then used to calculate cosine similarity with image features through dot product, thereby achieving cross-modal fusion of image and text.

3. According to claim 1, a GPA_VLPD global adaptive cross-modal single-stage pedestrian detection method is characterized by: The GPA-VLPD feature extraction module includes a simplified channel and spatial attention module GPA, which is used to perform adaptive feature refinement on the feature map, and obtain channel weights and spatial weights using a structure in which channel attention and spatial attention are calculated in parallel. The channel weights are used to adjust the feature response of each channel, and the spatial weights are used to adjust the feature responses of different spatial positions; then the channel weights and spatial weights are fused in an additive reactivation manner to obtain a unified 3D attention map; finally, the attention map and the input feature are multiplied pixel by pixel to achieve adaptive feature adjustment in both channel and space.

4. According to claim 3, a GPA_VLPD global adaptive cross-modal single-stage pedestrian detection method is characterized by: In the simplified channel and spatial attention module GPA: For channel attention: A ch (X)=F ex (F sq ,W)=σ[W2δ(W1(F GP (X)))] Use global average pooling F GP Compress the spatial information of the global feature map into a one-dimensional vector of size C×1×1: This vector represents the global importance of the channel feature; this vector is directly forwarded to a shared network with two fully connected layers and one hidden layer, and the reduction rate r of the dimension reduction layer is set to 16; the shared network is used to learn how to weight the feature response of each channel; after being processed by the shared network, in order to add the spatial features pixel by pixel, the feature vector is expanded to the input feature size using the σ(·) tensor expansion function to obtain the channel feature vector A ch (X); For spatial attention: A sp (X)=σ(W([F avg (X);F max (X)])) First, taking the channel of the feature as the axis, the input feature is globally averaged and max-pooled to obtain two 2D spatial attention features, and then the two generated spatial attention features are concat to generate a spatial attention map; A convolution operation with a convolution kernel of 7×7 is performed to reduce parameters and calculation amount; finally, the generated 2D spatial attention map is expanded to the input feature size using the expansion function to obtain the spatial feature vector A sp (X); Spatial channel fusion: The outputs of the channel branch and the spatial branch are synthesized in a parallel layout GMA(X)=Z⊙X=(F SG (A ch +A sp ))⊙X "+" means adding the channel feature weight and the spatial feature weight pixel by pixel to achieve the weighted fusion of channel information and spatial information; F SG is the activation function Sigmoid, which limits the output between 0 and 1 through the activation function, indicating the weight of each position; "⊙" is the pixel-by-pixel multiplication of the feature map and the 3D attention map.

5. According to claim 3, a GPA_VLPD global adaptive cross-modal single-stage pedestrian detection method is characterized by: In the GPA-VLPD feature extraction module, VLPD uses ResNet-50 as the backbone and initializes the weights of the pre-trained visual language model CLIP; VLPD does not perform downsampling in Stage 5, but uses dilated convolution to increase the receptive field, and adds SE-POSTblock to each layer of the last Stage of ResNet-50; The minimalist channel and the spatial attention module GPA are added after the p3 and p4 output layers of VLPD to form a GPA-VLPD feature extraction module.

6. The GPA_VLPD global adaptive cross-modal single-stage pedestrian detection method according to claim 5, characterized in that: During the training phase, the overall network architecture of the GPA-VLPD feature extraction module is as follows: The first part is the feature extraction module plus the CSP detection head. First, the trunk is initialized using the CLIP-ResNet50 pre-trained weights. Then, the input image is feature extracted and the feature vector output by the last layer of the trunk is fused with the text vector generated by CLIP. The p3, p4, and p5 of the trunk are uniformly deconvolved to the same size and spliced. The feature vectors that fuse the image and text information are upsampled and spliced ​​together. Finally, the CSP detection head performs inference and prediction directly on the feature map containing visual semantic information. The second part is to conduct unsupervised comparative learning between the p5 feature map that incorporates semantic information and the feature map generated by CLIP Image-Encoder that also incorporates semantic information; The third part is to perform prototype semantic comparative learning on the feature map after p3 deconvolution with the annotation box and the p5 feature map that integrates semantic information, bringing objects of the same category closer and moving objects of different categories farther away, thereby improving the model's ability to distinguish pedestrians and the environment.

7. The GPA_VLPD global adaptive cross-modal single-stage pedestrian detection method according to claim 6, characterized in that: In the inference stage, the GPA-VLPD feature extraction module only retains the first part and the corresponding weights obtained through training.

8. The GPA_VLPD global adaptive cross-modal single-stage pedestrian detection method according to claim 1, characterized in that: The dataset used for training is constructed as follows: first, the Citypersons high-resolution dataset is divided into a training set and a test set; the training set is randomly cropped to the same size and a label file of the corresponding position is generated; and then the training set is subjected to data augmentation operations such as random brightness change and random flipping.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of a GPA_VLPD globally adaptive cross-modal single-stage pedestrian detection method as described in any one of claims 1 to 8 are implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of a GPA_VLPD globally adaptive cross-modal single-stage pedestrian detection method as described in any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Feature fusion-based pedestrian detection and tracking method in view angle of fisheye lens

    CN116311348A

  • Text-pedestrian retrieval method based on bounding box extraction and semantic consistency constraint

    CN116842212A

  • Pedestrian re-identification method and system based on view angle decoupling self-attention network

    CN117975507A

  • Explainable transducer transformers

    US20220198254A1

  • Sequential pedestrian trajectory prediction using step attention for collision avoidance

    US20230038673A1