Subway pedestrian abnormal behavior detection method, device, equipment and storage medium
Through the improved YOLOv8 model, the deformable convolution module, ShuffleAttention attention mechanism and BiFPN network structure are used to solve the problem of low accuracy in detecting abnormal pedestrian behavior in subway scenes, and significantly improve the detection accuracy, especially for small targets in complex scenes. Detection effect.
Patent Information
- Application Number
- CN202410053403.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-12
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-01-12
AI Technical Summary
Existing subway pedestrian abnormal behavior detection methods have problems such as difficulty in detection, target occlusion, target blur, and low detection accuracy of small targets in complex scenes.
The improved YOLOv8 model is used, including the deformable convolution module, ShuffleAttention attention mechanism and BiFPN network structure, to preprocess and extract features of subway pedestrian images to enhance feature extraction capabilities and target detection effects.
It improves the accuracy of detecting abnormal pedestrian behavior in subway scenes, especially the accuracy of the crowd data set is increased by 2.43%, the accuracy of the fall data set is increased by 0.97%, and the accuracy of the smoke data set is increased by 10.14%, verifying the effectiveness of the improved algorithm. effectiveness.
Smart Images

Figure CN118097771B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of target detection technology, and in particular to a method, device, equipment and storage medium for detecting abnormal behavior of subway pedestrians. Background Art
[0002] With the continuous development of urban transportation systems, subways have become one of the main modes of transportation in many cities. For subway operation management, it is very important to ensure the safety and smoothness of the subway. However, various abnormal behaviors may occur in the subway system, such as smoking and falling, which may cause safety accidents or affect the normal operation of the subway. Therefore, how to detect these abnormal behaviors in a timely and accurate manner has become an important issue in subway safety management.
[0003] Existing abnormal behavior detection methods are usually based on manually designed features and statistical methods, but with the increasing complexity of monitoring scenes and the higher requirements for detection accuracy, the limitations of existing methods are becoming increasingly apparent. Especially in the face of complex, diverse and dynamically changing subway scenes, these methods have technical problems such as high detection difficulty, target occlusion, target blur and low small target detection accuracy. Summary of the invention
[0004] The main purpose of the present invention is to provide a method, device, equipment and storage medium for detecting abnormal behavior of subway pedestrians, aiming to solve the technical problems of pedestrian behavior detection methods in the prior art in complex subway scenes, such as high detection difficulty, target occlusion, target blur and low small target detection accuracy.
[0005] To achieve the above object, the present invention provides a method, device, equipment and storage medium for detecting abnormal behavior of subway pedestrians, the method comprising the following steps:
[0006] Preprocessing the acquired original subway pedestrian image to obtain a processed subway pedestrian image;
[0007] Based on the improved YOLOv8 model, abnormal behavior detection of subway pedestrians is performed on the processed subway pedestrian images to obtain behavior detection results, wherein the improved YOLOv8 model includes a preset backbone network and a preset neck network, the preset backbone network includes a deformable convolution module, and the preset neck network includes a ShuffleAttention mechanism and a BiFPN network structure;
[0008] The abnormal behavior of subway pedestrians is determined according to the behavior detection result.
[0009] Optionally, the improved YOLOv8 model further includes an input module, a detection head module and an output module, the input module is connected to the preset backbone network, the preset backbone network is connected to the preset neck network, the preset neck network is connected to the detection head module, and the detection head module is connected to the output module;
[0010] The abnormal behavior detection of subway pedestrians is performed on the processed subway pedestrian image based on the improved YOLOv8 model to obtain the behavior detection result, including:
[0011] Sending the processed subway pedestrian image to the input module for preprocessing to obtain an image to be tested;
[0012] Extracting features of the image to be tested by using the preset backbone network to obtain an initial feature map;
[0013] Performing feature fusion on the initial feature map through the preset neck network to obtain a feature map to be tested;
[0014] Perform subway pedestrian abnormal behavior detection on the feature graph to be detected by the detection head module to obtain prediction information;
[0015] The prediction information is transformed through the output module to obtain the behavior detection result.
[0016] Optionally, the preset C2f module in the deformable convolution module includes an added CSPDarknet53 module, and the CSPDarknet53 module includes a preset CSP structure;
[0017] The step of extracting features from the image to be tested by using the preset backbone network to obtain an initial feature map includes:
[0018] Multi-scale feature extraction is performed on the image to be tested through the preset CSP structure in the CSPDarknet53 module to obtain an initial feature map.
[0019] Optionally, the preset neck network further includes a C2f_DCN module;
[0020] The step of performing feature fusion on the initial feature map through the preset neck network to obtain the feature map to be tested includes:
[0021] The initial feature map is quickly normalized and fused through the BiFPN network structure in the preset neck network to obtain a preliminary fusion feature;
[0022] The preliminary fusion features are fused in the spatial attention dimension and the channel attention dimension through the ShuffleAttention mechanism in the preset neck network to obtain an attention fusion feature;
[0023] The attention fusion features are subjected to multi-level feature fusion through the C2f_DCN module in the preset neck network to obtain a feature map to be tested.
[0024] Optionally, fusing the preliminary fusion features in the spatial attention dimension and the channel attention dimension through the ShuffleAttention mechanism in the preset neck network to obtain the attention fusion features includes:
[0025] The preliminary fusion features are grouped in the channel dimension through the ShuffleAttention mechanism in the preset neck network to obtain multiple groups of sub-features;
[0026] The dependency relationship of each group of sub-features in the multiple groups of sub-features is captured in the spatial dimension and the channel dimension according to the Shuffle Unit, so as to obtain multiple groups of sub-features after feature capture;
[0027] The multiple groups of sub-features captured by the feature are fused through the Channel Shuffle operation to obtain the attention fusion feature.
[0028] Optionally, before preprocessing the acquired original subway pedestrian image to obtain the processed subway pedestrian image, the method further includes:
[0029] Get the CrowdHuman dataset containing pedestrian occlusion and blur, the Fall dataset containing abnormal pedestrian falling behavior, and the Smoke dataset containing abnormal pedestrian smoking behavior;
[0030] Divide the CrowdHuman dataset, the Fall dataset, and the smoke dataset into a training set, a test set, and a validation set;
[0031] The improved YOLOv8 model to be trained is iteratively trained according to the training set, the test set and the validation set to obtain an improved YOLOv8 model.
[0032] Optionally, the iterative training of the improved YOLOv8 model to be trained according to the training set, the test set and the validation set to obtain the improved YOLOv8 model includes:
[0033] Iteratively train the improved YOLOv8 model to be trained according to the training set to obtain multiple trained YOLOv8 models;
[0034] Performing performance verification on the multiple trained YOLOv8 models according to the mAP evaluation index, the test set, and the validation set to obtain mAP values, wherein the mAP evaluation index includes mAP50, mAP50-95, precision, and recall;
[0035] The trained YOLOv8 model corresponding to the maximum mAP value is selected to obtain an improved YOLOv8 model.
[0036] In addition, to achieve the above-mentioned purpose, the present invention further proposes a subway pedestrian abnormal behavior detection device, the subway pedestrian abnormal behavior detection device comprising:
[0037] An image processing module is used to pre-process the acquired original subway pedestrian image to obtain a processed subway pedestrian image;
[0038] A behavior detection module, used for performing abnormal behavior detection of subway pedestrians on the processed subway pedestrian images based on an improved YOLOv8 model to obtain a behavior detection result, wherein the improved YOLOv8 model includes a preset backbone network and a preset neck network, wherein the preset backbone network includes a deformable convolution module, and the preset neck network includes a ShuffleAttention mechanism and a BiFPN network structure;
[0039] The abnormality determination module is used to determine the abnormal behavior of subway pedestrians according to the behavior detection result.
[0040] In addition, to achieve the above-mentioned objectives, the present invention also proposes a subway pedestrian abnormal behavior detection device, which includes: a memory, a processor, and a subway pedestrian abnormal behavior detection program stored in the memory and executable on the processor, and the subway pedestrian abnormal behavior detection program is configured to implement the steps of the subway pedestrian abnormal behavior detection method described above.
[0041] In addition, to achieve the above-mentioned purpose, the present invention also proposes a storage medium, on which a subway pedestrian abnormal behavior detection program is stored. When the subway pedestrian abnormal behavior detection program is executed by a processor, the steps of the subway pedestrian abnormal behavior detection method described above are implemented.
[0042] In the present invention, an improved YOLOv8 model is used to detect abnormal behavior of subway pedestrians in processed subway pedestrian images. The improved YOLOv8 model includes a preset backbone network and a preset neck network. The preset backbone network includes a deformable convolution module, and the preset neck network includes a ShuffleAttention mechanism and a BiFPN network structure. In the present invention, for the problem that the abnormal behavior characteristics of pedestrians in subway scenes are fuzzy, adding a deformable convolution module can improve the feature extraction ability of the backbone network. For the problem that complex scenes in subways interfere with target detection, the ShuffleAttention mechanism is added to enhance the visible features of fuzzy targets and occluded targets. Finally, for the problem that small targets are difficult to detect in subway scenes, the BiFPN network structure is used to improve the detection effect of small targets, so that abnormal behavior of pedestrians in subways can be detected more accurately. Compared with the YOLOv8 model, the improved model has an accuracy rate of 2.43% on the crowd data set, an accuracy rate of 0.97% on the fall data set, and an accuracy rate of 10.14% on the smoke data set, which fully verifies the effectiveness of the improved algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 It is a structural diagram of a subway pedestrian abnormal behavior detection device in a hardware operating environment involved in an embodiment of the present invention;
[0044] Figure 2 This is a flow chart of a first embodiment of a method for detecting abnormal behavior of subway pedestrians according to the present invention;
[0045] Figure 3 It is a schematic diagram of the structure of the improved YOLOv8 model of the present invention;
[0046] Figure 4 This is a flow chart of a second embodiment of a method for detecting abnormal behavior of subway pedestrians according to the present invention;
[0047] Figure 5 It is a structural diagram of the preset CSP structure in the CSPDarknet53 module of the present invention;
[0048] Figure 6 It is a schematic diagram of the structure of the BiFPN network structure of the present invention;
[0049] Figure 7 It is a structural diagram of the ShuffleAttention module of the present invention;
[0050] Figure 8 It is a schematic diagram of the structure of the C2f_DCN module of the present invention;
[0051] Fig. 9It is a flow chart of the third embodiment of the method for detecting abnormal behavior of subway pedestrians of the present invention;
[0052] Fig.10 It is a structural block diagram of the first embodiment of the subway pedestrian abnormal behavior detection device of the present invention.
[0053] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0054] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0055] Reference Figure 1 , Figure 1 The figure is a schematic diagram of the structure of a subway pedestrian abnormal behavior detection device in the hardware operating environment involved in the embodiment of the present invention.
[0056] like Figure 1 As shown, the subway pedestrian abnormal behavior detection device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM), or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk storage. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0057] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the subway pedestrian abnormal behavior detection device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0058] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a subway pedestrian abnormal behavior detection program.
[0059] exist Figure 1 In the subway pedestrian abnormal behavior detection device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the subway pedestrian abnormal behavior detection device of the present invention can be set in the subway pedestrian abnormal behavior detection device, and the subway pedestrian abnormal behavior detection device calls the subway pedestrian abnormal behavior detection program stored in the memory 1005 through the processor 1001, and executes the subway pedestrian abnormal behavior detection method provided by the embodiment of the present invention.
[0060] The embodiment of the present invention provides a method for detecting abnormal behavior of subway pedestrians. Figure 2 , Figure 2 Schematic diagram of the process of the first embodiment of the method for detecting abnormal behavior of subway pedestrians in the present invention.
[0061] In this embodiment, the subway pedestrian abnormal behavior detection method includes the following steps:
[0062] Step S10: pre-processing the acquired original subway pedestrian image to obtain a processed subway pedestrian image.
[0063] It should be noted that the execution subject of the method of this embodiment can be a computing service device with subway pedestrian abnormal behavior detection, network communication and program running functions, such as a mobile phone, a tablet computer, a personal computer, etc.; it can also be the above-mentioned subway pedestrian abnormal behavior detection device with the same or similar functions. This embodiment and the following embodiments will be described by taking the subway pedestrian abnormal behavior detection device as an example.
[0064] It is understandable that various abnormal behaviors may occur in the subway system, such as smoking and falling, which may cause safety accidents or affect the normal operation of the subway. In order to ensure the safety and smoothness of the subway, real-time shooting can be performed at locations in the subway where abnormal behaviors are prone to occur, such as elevators, escalators, or seats in the hall. The captured images are pre-processed by denoising, cropping, resizing, etc. to obtain processed subway pedestrian images.
[0065] Step S20: Performing abnormal behavior detection on the processed subway pedestrian image based on the improved YOLOv8 model to obtain a behavior detection result, wherein the improved YOLOv8 model includes a preset backbone network and a preset neck network, the preset backbone network includes a deformable convolution module, and the preset neck network includes a ShuffleAttention mechanism and a BiFPN network structure.
[0066] Understandably, YOLOv8 is a SOTA model that expands on the historical versions of the YOLO series and introduces new features and improvements, making it the best choice for tasks such as target detection, image segmentation, and pose estimation. The innovations of YOLOv8 include the use of a new backbone network, Ancher-Free detection head, and an innovative loss function. These innovations not only bring more powerful performance to the model, but also enable it to run efficiently on a variety of hardware platforms from CPU to GPU.
[0067] It is worth noting that the improved YOLOv8 model in the present invention improves the backbone and neck modules, and uses the improved YOLOv8 model to detect abnormal behavior of subway pedestrians on the processed subway pedestrian images to obtain behavior detection results. The preset backbone network in the improved YOLOv8 model includes a deformable convolution module, and the preset neck network includes a ShuffleAttention mechanism and a BiFPN network structure. Figure 3 , Figure 3 This is a schematic diagram of the structure of the improved YOLOv8 model of the present invention. To solve the problem of blurred features of abnormal pedestrian behavior in subway scenes, a deformable convolution module is added to improve the feature extraction capability of the backbone network; secondly, to solve the problem that complex scenes in subways interfere with target detection, the ShuffleAttention mechanism is added to enhance the visible features of blurred targets and occluded targets; finally, to solve the problem that small targets are difficult to detect in subway scenes, the BiFPN network structure is used to improve the detection effect of small targets.
[0068] Step S30: determining the abnormal behavior of subway pedestrians according to the behavior detection result.
[0069] In this embodiment, the improved YOLOv8 model is used to detect abnormal behavior of subway pedestrians in processed subway pedestrian images. The improved YOLOv8 model includes a preset backbone network and a preset neck network. The preset backbone network includes a deformable convolution module, and the preset neck network includes a ShuffleAttention mechanism and a BiFPN network structure. In this embodiment, for the problem of blurred features of abnormal behavior of pedestrians in subway scenes, adding a deformable convolution module can improve the feature extraction ability of the backbone network. For the problem that complex scenes in subways interfere with target detection, the ShuffleAttention mechanism is added to enhance the visible features of blurred targets and occluded targets. Finally, for the problem that small targets are difficult to detect in subway scenes, the BiFPN network structure is used to improve the detection effect of small targets, so that abnormal behavior of pedestrians in subways can be detected more accurately. Compared with the YOLOv8 model, the improved model has an accuracy rate of 2.43% on the crowd data set, an accuracy rate of 0.97% on the fall data set, and an accuracy rate of 10.14% on the smoke data set, which fully verifies the effectiveness of the improved algorithm.
[0070] refer to Figure 4 , Figure 4 Schematic diagram of the flow of the second embodiment of the method for detecting abnormal behavior of subway pedestrians in the present invention.
[0071] Furthermore, in order to improve the generalization performance of the model, the improved YOLOv8 model also includes an input module, a detection head module and an output module. The input module is connected to a preset backbone network, the preset backbone network is connected to a preset neck network, the preset neck network is connected to the detection head module, and the detection head module is connected to the output module. The above modules collaborate to perform abnormal behavior detection of subway pedestrians.
[0072] Therefore, based on the above first embodiment, in this embodiment, the improved YOLOv8 model further includes an input module, a detection head module and an output module, the input module is connected to the preset backbone network, the preset backbone network is connected to the preset neck network, the preset neck network is connected to the detection head module, and the detection head module is connected to the output module; the step S20 includes:
[0073] Step S201: sending the processed subway pedestrian image to the input module for preprocessing to obtain an image to be tested.
[0074] It is understandable that the processed subway pedestrian images can be sent to the input module, and the input module improves the generalization ability of the model by performing data enhancement methods such as mosaic data enhancement, adaptive image scaling, splicing, and superposition on the input images.
[0075] Step S202: extracting features of the image to be tested through the preset backbone network to obtain an initial feature map.
[0076] It is understandable that the feature extraction capability of the backbone network can be improved by presetting the deformable convolution module in the backbone network to perform feature extraction on the image to be tested.
[0077] Furthermore, in order to optimize the feature representation capability of the model and enable it to more effectively capture target features at different scales, the C2f module introduces CSPDarknet53 in the improved YOLOv8. Through the CSP structure, CSPDarknet53 can fuse information between feature maps of different scales, thereby improving the accuracy of target detection. Therefore, the preset C2f module in the deformable convolution module includes an added CSPDarknet53 module, and the CSPDarknet53 module includes a preset CSP structure; the step S202 also includes: performing multi-scale feature extraction on the image to be tested through the preset CSP structure in the CSPDarknet53 module to obtain an initial feature map.
[0078] It should be noted that the C2f module in YOLOv8 was improved by introducing the CSPDarknet53 module. This module improves Darknet53 and adopts Figure 5 The CSP (Cross Stage Partial) structure shown in the figure is used to achieve the purpose of feature fusion. Figure 5 The figure is a schematic diagram of the structure of the preset CSP structure in the CSPDarknet53 module of the present invention. Through the CSP structure, CSPDarknet53 can fuse information between feature maps of different scales, thereby improving the accuracy of target detection. This improvement aims to optimize the feature representation ability of the model so that it can more effectively capture target features at different scales.
[0079] Step S203: performing feature fusion on the initial feature map through the preset neck network to obtain a feature map to be tested.
[0080] It is easy to understand that, based on the preset neck network, the initial feature map can be fused with features in multiple dimensions to obtain the feature map to be tested.
[0081] Furthermore, in order to effectively improve the accuracy, robustness and efficiency of subway abnormal behavior detection, and to help better cope with complex subway environments and various abnormal behavior situations, feature fusion can be performed through the BiFPN network structure, ShuffleAttention mechanism and C2f_DCN module in the preset neck network. Therefore, the preset neck network also includes a C2f_DCN module; the step S203 includes: performing fast normalization fusion on the initial feature map through the BiFPN network structure in the preset neck network to obtain preliminary fusion features; fusing the preliminary fusion features in the spatial attention dimension and the channel attention dimension through the ShuffleAttention mechanism in the preset neck network to obtain attention fusion features; performing multi-level feature fusion on the attention fusion features through the C2f_DCN module in the preset neck network to obtain the feature map to be tested.
[0082] It is worth noting that existing feature fusion methods usually use the same weight to weight feature maps of different scales. When the resolution of the input feature map is different, using the same weight for weighting may lead to uneven output feature maps. BiFPN considers the importance of different input features and uses different weights for feature fusion. By repeatedly applying this structure, feature fusion is enhanced, thereby more effectively processing input feature maps of different resolutions. BiFPN is a bidirectional feature pyramid network. In computer vision, this neural network architecture is widely used in target detection and segmentation tasks. You can refer to Figure 6 , Figure 6 The figure is a schematic diagram of the BiFPN network structure of the present invention. The weighted fusion method in the BiFPN structure adopts fast normalized fusion, which is proposed for the slow training speed. The weight is scaled to the range of 0 to 1. Since the Softmax method is not used, the training speed is very fast. The cross-scale connection is realized by adding a skip connection and a bidirectional path, thus realizing weighted fusion and bidirectional cross-scale connection.
[0083] It is understandable that existing attention mechanisms tend to focus only on channel attention or spatial attention, and have a low global understanding of features. In large-scale deep networks, traditional attention mechanisms have higher computational costs, slower reasoning speeds, and poor performance in complex scenarios. The ShuffleAttention mechanism effectively combines spatial and channel attention mechanisms. Figure 7 , Figure 7 It is a structural diagram of the ShuffleAttention module of the present invention.
[0084] It should be understood that, finally, the attention fusion features can be fused at multiple levels through the C2f_DCN module to obtain the feature map to be tested, which can effectively improve the accuracy, robustness and efficiency of subway abnormal behavior detection, and help to better cope with complex subway environments and various abnormal behavior situations. Figure 8 , Figure 8 The schematic diagram of the structure of the C2f_DCN module of the present invention is shown in FIG. C2f_DCN learns the offset through a new module, making the learned offset more stable and accurate, and combines traditional convolution with variable convolution to provide a more flexible operation to obtain better feature representation.
[0085] Furthermore, since the existing attention mechanism tends to focus only on channel attention or spatial attention, the global understanding of features is low, and in large-scale deep networks, the existing attention mechanism has higher computational cost, slower reasoning speed, and poor application performance in complex scenarios. Therefore, the ShuffleAttention mechanism is selected to effectively combine the spatial and channel attention mechanisms for feature fusion. Therefore, step S203 also includes: grouping the preliminary fused features in the channel dimension through the ShuffleAttention mechanism in the preset neck network to obtain multiple groups of sub-features; capturing the dependency relationship of each group of sub-features in the multiple groups of sub-features in the spatial dimension and the channel dimension according to the Shuffle Unit, and obtaining multiple groups of sub-features after feature capture; and performing feature fusion on the multiple groups of sub-features after feature capture through the ChannelShuffle operation to obtain attention fusion features.
[0086] Specifically, the process of fusing the preliminary fusion features in the spatial attention dimension and the channel attention dimension by using the ShuffleAttention mechanism in the preset neck network can be as follows: first, the channel dimension is grouped into multiple sub-features, and then these sub-features are processed in parallel. Next, for each sub-feature, the Shuffle Unit is used to capture the dependencies between features in the spatial and channel dimensions. Finally, all sub-features are brought together, and the features of different groups are fused through the ChannelShuffle operation.
[0087] Step S204: Perform subway pedestrian abnormal behavior detection on the feature graph to be detected by the detection head module to obtain prediction information.
[0088] Step S205: transforming the prediction information through the output module to obtain a behavior detection result.
[0089] It is understandable that the detection head module can further process the feature maps to be tested extracted by the backbone network and the neck network and generate prediction information of abnormal behavior of subway pedestrians, and then the output module can convert the prediction information obtained by the detection head into the final behavior detection result.
[0090] In this embodiment, it is disclosed that the processed subway pedestrian image is sent to the input module for preprocessing to obtain the image to be tested, the feature extraction of the image to be tested is performed through a preset backbone network to obtain an initial feature map, the feature fusion of the initial feature map is performed through a preset neck network to obtain the feature map to be tested, the abnormal behavior of subway pedestrians is detected on the feature map to be tested by the detection head module to obtain prediction information, and the prediction information is transformed through the output module, thereby improving the generalization performance of the model and being able to detect abnormal behavior of pedestrians in complex scenes of the subway in real time.
[0091] refer to Fig. 9 , Fig. 9 Schematic diagram of the flow of the third embodiment of the method for detecting abnormal behavior of subway pedestrians in the present invention.
[0092] Furthermore, since the currently available abnormal behavior datasets for subway scenes rarely contain situations where crowds and abnormal behaviors appear at the same time, in order to enrich the training and prove the effectiveness of the improved algorithm, the public CrowdHuman pedestrian dataset, Fall dataset, and smoke dataset are used to verify the improved effects of the algorithm in this paper on dense scene and abnormal behavior detection.
[0093] Therefore, based on the above first embodiment, in this embodiment, before step S10, the following is further included:
[0094] Step S01: Acquire the CrowdHuman dataset containing pedestrian occlusion and blur, the Fall dataset containing abnormal pedestrian falling behavior, and the smoke dataset containing abnormal pedestrian smoking behavior.
[0095] Step S02: Divide the CrowdHuman dataset, the Fall dataset, and the smoke dataset into a training set, a test set, and a validation set.
[0096] Step S03: iteratively training the improved YOLOv8 model to be trained according to the training set, the test set and the validation set to obtain an improved YOLOv8 model.
[0097] It is worth noting that in order to prove the effectiveness of the improved algorithm, the public CrowdHuman pedestrian dataset, Fall dataset, and smoke dataset can be used to iteratively train the improved YOLOv8 model to be trained, and the improved effect of the improved YOLOv8 model on dense scene and abnormal behavior detection can be verified during the training process. The CrowdHuman dataset is a dataset designed for pedestrian detection. The images in this dataset have a large data scale, including 15,000 images in the training set, 5,000 images in the test set, and 4,370 images in the validation set. In the entire dataset, the training set and validation set contain a total of about 470,000 instances, each image contains an average of about 23 people, and includes various occlusion situations. The Fall dataset is a dataset of abnormal fall behavior collected on the Baidu PaddlePaddle community. The training set contains 7,630 images and the validation set contains 152 images. The dataset includes two abnormal human states: falling and standing, with various image angles and different falling postures, which are used to test the detection effect of the model on abnormal human behavior. The smoke dataset is a dataset of abnormal smoking behaviors collected on the Baidu PaddlePaddle community. The dataset contains 455 training sets, 168 validation sets, and 160 test sets. Cigarette instances are annotated in the dataset to test the model's detection effect on small targets.
[0098] In the specific implementation, the hardware equipment of the experimental environment for model training and verification can be shown in Table 1 below:
[0099] Configuration parameter CPU Intel Core i7-11800H Memory / GB 16G GPU GeForce RTX 3060 Laptop Video memory / GB 6G Training environment CUDA 11.8 operating system Windows 10 Development Environment Python 3.8 Pytorch 2.0.1
[0100] Among them, the training iteration cycle can be set to 100 and the batch size can be set to 4.
[0101] Furthermore, since mAP is a general evaluation index of the performance of the target detection algorithm, the algorithm performance is comprehensively evaluated by calculating the average accuracy of the target detection algorithm under different confidence thresholds. Therefore, mAP50, mAP50-95, precision and recall can be used as the main evaluation indicators for performance evaluation, and the model with the best performance is selected for application in the detection of abnormal behavior of subway pedestrians. Therefore, the step S03 includes: iteratively training the improved YOLOv8 model to be trained according to the training set to obtain multiple trained YOLOv8 models; performing performance verification on multiple trained YOLOv8 models according to the mAP evaluation index, the test set and the verification set to obtain mAP values, and the mAP evaluation index includes mAP50, mAP50-95, precision and recall; selecting the trained YOLOv8 model corresponding to the maximum mAP value to obtain an improved YOLOv8 model.
[0102] It is worth noting that mAP is a common evaluation indicator for the performance of target detection algorithms. It comprehensively evaluates the performance of the algorithm by calculating the average accuracy of the target detection algorithm under different confidence thresholds. This article uses mAP50, mAP50-95, precision and recall as the main evaluation indicators.
[0103] In object detection, the intersection-over-union metric is usually used to measure the overlap between the predicted box and the true labeled box. When calculating mAP, first sort all detection results from high to low according to the confidence level, and then calculate the precision and recall of each predicted box at different confidence thresholds one by one. Finally, sum the area under the precision-recall curve (AUC) at all confidence thresholds and divide it by the number of categories to get the mAP value, as shown in the following formula:
[0104]
[0105] In the above formula, P represents the proportion of predicted boxes that actually detect the target to all predicted boxes, and R represents the proportion of predicted boxes that actually detect the target to all real labeled boxes. Therefore, the PR curve shows the changes in precision and recall under different thresholds, and AUC is the area under the curve, which is used to measure the overall performance of the algorithm under different confidence thresholds. The calculation formulas for P and R are as follows:
[0106]
[0107] In the above formula, TP represents the number of detection boxes predicted by the model as positive samples and matching the true annotations; FP represents the number of detection boxes predicted by the model as positive samples but not matching the true annotations; and FN represents the number of true annotations that the model failed to detect.
[0108] mAP@0.5 is defined as the average precision (AP@0.5) of the corresponding category when the IoU (intersection over union) threshold is 0.5, as shown in the following formula:
[0109]
[0110] mAP@0.5∶0.95: The average mAP calculated at different IoU thresholds (from 0.5 to 0.95, with a step size of 0.05). This value is used to measure the performance of the model in terms of boundary regression ability and the fitting accuracy of the detection box and the target box.
[0111] It should be understood that a performance comparison can be performed to verify the effect of the improved YOLOv8 model. In the target detection model, the experiment uses the YOLOv5 and YOLOv8 models to compare with the improved YOLOv8 model. The results show that the performance indicators of the improved YOLOv8 model are improved compared with YOLOv5 and YOLOv8 in multiple data sets. The experimental results of each model on the crowd data set are shown in Table 2, the experimental results of each model on the fall data set are shown in Table 3, and the experimental results of each model on the smoke data set are shown in Table 4.
[0112] Table 2 Detection accuracy of each model under crowd dataset
[0113] Model Accuracy % mAP@0.5% mAP@0.5: 0.95% YOLOv5 84.20 85.07 57.51 YOLOv8 84.39 85.95 61.80 Improving YOLOv8 86.82 86.81 63.55
[0114] Table 3 Detection accuracy of each model on the fall dataset
[0115] Model Accuracy % mAP@0.5% mAP@0.5: 0.95% YOLOv5 76.88 77.85 46.41 YOLOv8 78.05 79.35 51.61 Improving YOLOv8 79.02 80.00 53.23
[0116] Table 4 Detection accuracy of each model on the smoke dataset
[0117] Model Accuracy % mAP@0.5% mAP@0.5: 0.95% YOLOv5 63.75 63.82 25.42 YOLOv8 65.88 65.68 27.39 Improving YOLOv8 76.02 74.28 30.62
[0118] The test results show that adding the deformable convolution module, the ShuffleAttention mechanism, and the BiFPN network structure to YOLOv8 can effectively improve the accuracy of pedestrian detection and the precision of abnormal behavior detection, proving that the improved method of the present invention is effective.
[0119] It is understandable that ablation experiments can also be performed for verification. All ablation experiments are performed on the crowd dataset. In order to verify the impact of the proposed improved module on the detection effect, Table 5 is an ablation experiment with the YOLOv8-n model as the baseline, the improved deformable convolution module, the ShuffleAttention mechanism and the BiFPN network structure. The detection accuracy can be further improved by the deformable convolution module, the ShuffleAttention mechanism and the BiFPN network structure. The final accuracy, AP50 and AP50∶95 reached 86.82%, 86.81% and 63.55% respectively, which were 2.43%, 0.86% and 1.74% higher than YOLOv8.
[0120] Table 5 Module ablation experiment
[0121]
[0122] In this embodiment, it is disclosed that the CrowdHuman pedestrian dataset, the Fall dataset, and the smoke dataset are obtained as the training set, the test set, and the verification set to iteratively train the improved YOLOv8 model to be trained, so that the crowd dataset and the dataset of abnormal data behavior can be combined to iteratively train the improved YOLOv8 model to be trained, so that the results of dense scene and abnormal behavior detection can be verified, and the improved YOLOv8 model with better performance can be obtained.
[0123] In addition, an embodiment of the present invention further proposes a storage medium, on which a subway pedestrian abnormal behavior detection program is stored. When the subway pedestrian abnormal behavior detection program is executed by a processor, the steps of the subway pedestrian abnormal behavior detection method described above are implemented.
[0124] Reference Fig.10 , Fig.10 It is a structural block diagram of the first embodiment of the subway pedestrian abnormal behavior detection device of the present invention.
[0125] like Fig.10 As shown, the subway pedestrian abnormal behavior detection device proposed in the embodiment of the present invention includes:
[0126] The image processing module 1001 is used to pre-process the acquired original subway pedestrian image to obtain a processed subway pedestrian image;
[0127] A behavior detection module 1002 is used to perform abnormal behavior detection of subway pedestrians on the processed subway pedestrian images based on an improved YOLOv8 model to obtain a behavior detection result, wherein the improved YOLOv8 model includes a preset backbone network and a preset neck network, wherein the preset backbone network includes a deformable convolution module, and the preset neck network includes a ShuffleAttention mechanism and a BiFPN network structure;
[0128] The abnormality determination module 1003 is used to determine the abnormal behavior of subway pedestrians according to the behavior detection result.
[0129] This embodiment detects abnormal behavior of subway pedestrians on processed subway pedestrian images based on an improved YOLOv8 model. The improved YOLOv8 model includes a preset backbone network and a preset neck network. The preset backbone network includes a deformable convolution module, and the preset neck network includes a ShuffleAttention mechanism and a BiFPN network structure. In this embodiment, for the problem of blurred features of abnormal behavior of pedestrians in subway scenes, adding a deformable convolution module can improve the feature extraction capability of the backbone network. For the problem that complex scenes in subways interfere greatly with target detection, the ShuffleAttention mechanism is added to enhance the visible features of blurred targets and occluded targets. Finally, for the problem that small targets are difficult to detect in subway scenes, the BiFPN network structure is used to improve the detection effect of small targets, so that abnormal behavior of pedestrians in subways can be detected more accurately.
[0130] Based on the first embodiment of the device for detecting abnormal behavior of subway pedestrians of the present invention, a second embodiment of the device for detecting abnormal behavior of subway pedestrians of the present invention is proposed.
[0131] In this embodiment, the behavior detection module 1002 is also used to send the processed subway pedestrian image to the input module for preprocessing to obtain the image to be tested; perform feature extraction on the image to be tested through the preset backbone network to obtain an initial feature map; perform feature fusion on the initial feature map through the preset neck network to obtain a feature map to be tested; perform abnormal behavior detection of subway pedestrians on the feature map to be tested through the detection head module to obtain prediction information; and convert the prediction information through the output module to obtain a behavior detection result.
[0132] As an implementation manner, the behavior detection module 1002 is further used to perform multi-scale feature extraction on the image to be tested through a preset CSP structure in the CSPDarknet53 module to obtain an initial feature map.
[0133] As an implementation mode, the behavior detection module 1002 is also used to quickly normalize and fuse the initial feature map through the BiFPN network structure in the preset neck network to obtain preliminary fusion features; fuse the preliminary fusion features in the spatial attention dimension and the channel attention dimension through the ShuffleAttention mechanism in the preset neck network to obtain attention fusion features; perform multi-level feature fusion on the attention fusion features through the C2f_DCN module in the preset neck network to obtain the feature map to be tested.
[0134] As an implementation mode, the behavior detection module 1002 is also used to group the preliminary fused features in the channel dimension through the ShuffleAttention mechanism in the preset neck network to obtain multiple groups of sub-features; capture the dependency relationship of each group of sub-features in the multiple groups of sub-features in the spatial dimension and the channel dimension according to the Shuffle Unit, and obtain multiple groups of sub-features after feature capture; and fuse the multiple groups of sub-features after feature capture through the Channel Shuffle operation to obtain attention fusion features.
[0135] As an implementation mode, the behavior detection module 1002 is further used to obtain a CrowdHuman dataset containing pedestrian occlusion and blur, a Fall dataset containing abnormal pedestrian falling behavior, and a smoke dataset containing abnormal pedestrian smoking behavior; divide the CrowdHuman dataset, the Fall dataset, and the smoke dataset into a training set, a test set, and a validation set; and iteratively train the improved YOLOv8 model to be trained according to the training set, the test set, and the validation set to obtain an improved YOLOv8 model.
[0136] As an implementation mode, the behavior detection module 1002 is further used to iteratively train the improved YOLOv8 model to be trained according to the training set to obtain multiple trained YOLOv8 models; perform performance verification on the multiple trained YOLOv8 models according to the mAP evaluation index, the test set and the verification set to obtain mAP values, wherein the mAP evaluation index includes mAP50, mAP50-95, precision and recall; and select the trained YOLOv8 model corresponding to the largest mAP value to obtain an improved YOLOv8 model.
[0137] Other embodiments or specific implementations of the subway pedestrian abnormal behavior detection device of the present invention can refer to the above-mentioned method embodiments, which will not be described in detail here.
[0138] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0139] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0140] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0141] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for detecting abnormal behavior of subway pedestrians, characterized in that: The subway pedestrian abnormal behavior detection method comprises: Preprocessing the acquired original subway pedestrian image to obtain a processed subway pedestrian image; Based on the improved YOLOv8 model, abnormal behavior detection of subway pedestrians is performed on the processed subway pedestrian image to obtain a behavior detection result, wherein the improved YOLOv8 model includes a preset backbone network and a preset neck network, wherein the preset backbone network includes a deformable convolution module, and the preset neck network includes a ShuffleAttention mechanism, a BiFPN network structure, and a C2f_DCN module; the improved YOLOv8 model also includes an input module, a detection head module, and an output module, wherein the input module is connected to the preset backbone network, the preset backbone network is connected to the preset neck network, the preset neck network is connected to the detection head module, and the detection head module is connected to the output module; determining abnormal behavior of subway pedestrians according to the behavior detection results; The abnormal behavior detection of subway pedestrians is performed on the processed subway pedestrian image based on the improved YOLOv8 model to obtain the behavior detection result, including: Sending the processed subway pedestrian image to the input module for preprocessing to obtain an image to be tested; Extracting features of the image to be tested by using the preset backbone network to obtain an initial feature map; The initial feature map is quickly normalized and fused through the BiFPN network structure in the preset neck network to obtain a preliminary fusion feature; The preliminary fusion features are fused in the spatial attention dimension and the channel attention dimension through the ShuffleAttention mechanism in the preset neck network to obtain an attention fusion feature; Perform multi-level feature fusion on the attention fusion feature through the C2f_DCN module in the preset neck network to obtain a feature map to be tested; Perform subway pedestrian abnormal behavior detection on the feature graph to be detected by the detection head module to obtain prediction information; The prediction information is transformed through the output module to obtain the behavior detection result.
2. The method for detecting abnormal behavior of subway pedestrians according to claim 1, characterized in that: The preset C2f module in the deformable convolution module includes a CSPDarknet53 module, and the CSPDarknet53 module includes a preset CSP structure; The step of extracting features from the image to be tested by using the preset backbone network to obtain an initial feature map includes: Multi-scale feature extraction is performed on the image to be tested through the preset CSP structure in the CSPDarknet53 module to obtain an initial feature map.
3. The method for detecting abnormal behavior of subway pedestrians according to claim 1, characterized in that: The method of fusing the preliminary fusion features in the spatial attention dimension and the channel attention dimension through the ShuffleAttention mechanism in the preset neck network to obtain the attention fusion features includes: The preliminary fusion features are grouped in the channel dimension through the ShuffleAttention mechanism in the preset neck network to obtain multiple groups of sub-features; The dependency relationship of each group of sub-features in the multiple groups of sub-features is captured in the spatial dimension and the channel dimension according to the Shuffle Unit, so as to obtain multiple groups of sub-features after feature capture; The multiple groups of sub-features captured by the feature are fused through the Channel Shuffle operation to obtain the attention fusion feature.
4. The method for detecting abnormal behavior of subway pedestrians according to claim 1, characterized in that: Before the obtained original subway pedestrian image is preprocessed to obtain the processed subway pedestrian image, the method further includes: Get the CrowdHuman dataset containing pedestrian occlusion and blur, the Fall dataset containing abnormal pedestrian falling behavior, and the Smoke dataset containing abnormal pedestrian smoking behavior; Divide the CrowdHuman dataset, the Fall dataset, and the smoke dataset into a training set, a test set, and a validation set; The improved YOLOv8 model to be trained is iteratively trained according to the training set, the test set and the validation set to obtain an improved YOLOv8 model.
5. The method for detecting abnormal behavior of subway pedestrians according to claim 4, characterized in that: The iterative training of the improved YOLOv8 model to be trained according to the training set, the test set and the validation set to obtain the improved YOLOv8 model includes: Iteratively train the improved YOLOv8 model to be trained according to the training set to obtain multiple trained YOLOv8 models; Performing performance verification on the multiple trained YOLOv8 models according to the mAP evaluation index, the test set, and the validation set to obtain mAP values, wherein the mAP evaluation index includes mAP50, mAP50-95, precision, and recall; The trained YOLOv8 model corresponding to the maximum mAP value is selected to obtain an improved YOLOv8 model.
6. A subway pedestrian abnormal behavior detection device, characterized in that: The subway pedestrian abnormal behavior detection device comprises: An image processing module is used to pre-process the acquired original subway pedestrian image to obtain a processed subway pedestrian image; A behavior detection module, used for performing abnormal behavior detection of subway pedestrians on the processed subway pedestrian images based on an improved YOLOv8 model to obtain a behavior detection result, wherein the improved YOLOv8 model includes a preset backbone network and a preset neck network, wherein the preset backbone network includes a deformable convolution module, and the preset neck network includes a ShuffleAttention mechanism, a BiFPN network structure, and a C2f_DCN module; the improved YOLOv8 model also includes an input module, a detection head module, and an output module, wherein the input module is connected to the preset backbone network, the preset backbone network is connected to the preset neck network, the preset neck network is connected to the detection head module, and the detection head module is connected to the output module; An abnormality determination module, used to determine the abnormal behavior of subway pedestrians according to the behavior detection result; The behavior detection module is also used to send the processed subway pedestrian image to the input module for preprocessing to obtain the image to be tested; perform feature extraction on the image to be tested through the preset backbone network to obtain an initial feature map; perform fast normalization fusion on the initial feature map through the BiFPN network structure in the preset neck network to obtain a preliminary fusion feature; fuse the preliminary fusion features in the spatial attention dimension and the channel attention dimension through the ShuffleAttention mechanism in the preset neck network to obtain an attention fusion feature; perform multi-level feature fusion on the attention fusion features through the C2f_DCN module in the preset neck network to obtain a feature map to be tested; perform abnormal behavior detection of subway pedestrians on the feature map to be tested through the detection head module to obtain prediction information; and transform the prediction information through the output module to obtain a behavior detection result.
7. A subway pedestrian abnormal behavior detection device, characterized in that: The device includes: a memory, a processor, and a subway pedestrian abnormal behavior detection program stored in the memory and executable on the processor, wherein the subway pedestrian abnormal behavior detection program is configured to implement the steps of the subway pedestrian abnormal behavior detection method as described in any one of claims 1 to 5.
8. A storage medium, characterized in that: The storage medium stores a subway pedestrian abnormal behavior detection program, and when the subway pedestrian abnormal behavior detection program is executed by the processor, the steps of the subway pedestrian abnormal behavior detection method according to any one of claims 1 to 5 are implemented.
