A subway gate fare evasion early warning method fusing target detection and behavior recognition
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NANNING UNIV
- Filing Date
- 2026-01-26
- Publication Date
- 2026-06-05
AI Technical Summary
The existing subway ticketing management system is inadequate in terms of automation, recognition accuracy, and anti-obstruction capabilities, making it difficult to effectively identify and warn against fare evasion behaviors such as tailgating, climbing, and crossing.
An improved YOLOv1 model combined with a lightweight spatiotemporal graph convolutional network is used to capture real-time video stream data of the subway gate area through target detection and behavior recognition, extract pedestrian targets and key points, generate spatiotemporal trajectories, identify fare evasion behavior, and set confidence thresholds to trigger early warnings.
It enables real-time and accurate early warning of fare evasion, significantly reduces false alarm and missed alarm rates, provides a complete chain of evidence, and improves the automation level of subway ticketing management.
Smart Images

Figure CN122157084A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of early warning system technology, specifically to a method for early warning of fare evasion at subway turnstiles that integrates target detection and behavior recognition. Background Technology
[0002] As the core of urban public transportation, the subway's ticketing management directly impacts operational revenue and public safety. Fare evasion behaviors such as tailgating and crossing over are long-standing management challenges, easily leading to revenue loss and traffic chaos. Currently, subway fare evasion warnings mainly rely on manual video surveillance and basic sensor technology, which suffers from low automation, slow response times, and insufficient recognition accuracy.
[0003] Existing technologies have two main limitations: First, methods based on physical sensors such as infrared beam detectors are prone to false alarms due to legitimate obstruction during peak hours, and are completely unable to identify behavioral intent, failing to detect non-blocking behaviors such as tailgating. Second, video analysis based on static distance determination can judge whether pedestrians are too close to the turnstile by setting fixed thresholds, but it cannot understand pedestrian posture and continuous behavior patterns, has a low recognition rate for dynamic violations such as crawling and crossing, and has weak anti-obstruction capabilities.
[0004] Therefore, there is an urgent need for a new technology that integrates target detection and behavior recognition, which can use pedestrians as the analysis unit, accurately locate pedestrians, analyze their skeletal key points, track their spatiotemporal trajectories, and ultimately understand their behavioral intentions. This would achieve a technological leap from "perceiving occlusion" to "understanding behavior," and meet the urgent need for real-time and accurate early warning of fare evasion in subway operations. Summary of the Invention
[0005] To achieve the above objectives, this invention provides a subway turnstile fare evasion warning method that integrates target detection and behavior recognition.
[0006] The present invention adopts the following technical solution:
[0007] A method for early warning of fare evasion at subway turnstiles that integrates object detection and behavior recognition includes the following steps:
[0008] S1. Collect continuous video stream data of the subway gate area, capture video information of the gate channel and surrounding set range in real time, extract frames of the video stream according to the set frame rate, and perform noise reduction and size standardization preprocessing to obtain standardized frame images.
[0009] S2. Based on the original YOLOv12 model, an improved YOLOv12 model is obtained to perform target detection on standardized frame images. By introducing channel attention module and spatial attention module, the network and dynamic adaptation detection head are extracted, and the bounding box coordinates of pedestrian targets in the gate area, the coordinates of 25 human body key points, and the confidence scores of each detection result are output simultaneously.
[0010] S3. The YOLOv12 model loss calculation module is reconstructed and improved. The loss function is improved to a weighted composite loss function. The effectiveness of the detected human key points is screened, invalid key points with confidence scores below 0.2 are removed, and pedestrian target data with completeness meeting the threshold requirements are retained to form a cleaned pedestrian target detection result set.
[0011] S4. An improved Hungarian algorithm is used to match and track the cleaned pedestrian targets in consecutive frames. A matching cost function is constructed by combining bounding box overlap, key point distance and appearance feature similarity to adapt to the dynamics of the subway gate scene, thereby generating the complete spatiotemporal trajectory and key point sequence of each pedestrian from entering to leaving the gate area.
[0012] S5. Based on the pedestrian spatiotemporal trajectory and key point sequence, extract the fare evasion behavior feature parameters such as coverage, passage time interval, key point pose angle and trajectory overlap rate, input them into a lightweight spatiotemporal graph convolutional network for behavior recognition, and finally obtain a confidence value. Based on the confidence value, determine whether there is a fare evasion behavior such as tailgating, crawling, or climbing.
[0013] S6. When the confidence value of the behavior recognition result is higher than the preset threshold, an early warning signal is immediately triggered, and the timestamp of the fare evasion behavior, five consecutive video clips, a visual screenshot of the pedestrian trajectory, and a recognition result report are recorded simultaneously.
[0014] Furthermore, in step S1, the video stream is captured using a high-definition camera with a resolution of no less than 1920×1080, capturing images of the gate passage and its surrounding 1.5-meter range at a frame rate of 30fps. The captured images need to undergo noise reduction preprocessing and be uniformly scaled to 640×640 pixels to ensure the consistency of the input model image size.
[0015] To achieve effective image denoising, YOLOv12's... The module performs noise suppression using the following formula:
[0016]
[0017] in, For the clear image after noise reduction, The original frame image containing noise. for The set of network parameters, for The mapping function;
[0018] The network training process is optimized using a loss function, the formula of which is:
[0019]
[0020] in, The number of training samples, For the first Noise-free, ground-label images of each sample; For the first The noisy original frame image of each sample;
[0021] During the image size normalization stage, a bilinear interpolation algorithm is used to scale the image. The scaled pixel is calculated by weighted averaging of the values of four adjacent pixels, thus avoiding jagged edges. Let the original image pixel coordinates be... The scaled coordinates are The mapping relationship between the original and scaled coordinates is then:
[0022] ,
[0023] in, It is the width of the original image. It is the original image high, = =640 is the target size. It is the width of the scaled image. It is the height of the scaled image.
[0024] Pick integer part decimal part , integer part decimal part Then the scaled pixel value for:
[0025]
[0026] in, In the original image pixel values, In the original image Pixel values of adjacent points on the right, In the original image Pixel values of adjacent points on the lower side In the original image The pixel value of the adjacent point at the bottom right.
[0027] Furthermore, in the target detection step S2, an addition based on the original YOLOv12 model is made. The hybrid attention mechanism effectively enhances the model's feature extraction capability for pedestrian targets by fusing channel attention and spatial attention modules. The specific calculations are as follows:
[0028] Channel attention weight calculation:
[0029]
[0030] in, for The module outputs a feature map. for Activation function Here is the number of neurons in the hidden layer; for a two-layer perceptron, this represents 1 / 4 of the input dimension. and These are global average pooling and global max pooling operations, respectively.
[0031] Spatial attention weight calculation:
[0032]
[0033] in, This is a 3×3 convolution operation with stride 1 and padding 1. For channel concatenation operations, the results of global average pooling and global max pooling operations are merged according to the channel dimension;
[0034] The final enhanced feature map is generated using the following formula:
[0035]
[0036] in, The feature map after attention enhancement. To facilitate element-wise multiplication, pedestrian target features are highlighted through dual channel and spatial weight modulation.
[0037] In the detection head section, a dynamic anchor frame adaptation mechanism is adopted to collect pedestrian image annotation data in the turnstile area, and based on pedestrian size statistics in the subway turnstile scene, it utilizes... The clustering algorithm regenerates 6 fitting anchor boxes, and the clustering loss function is defined as:
[0038]
[0039] in, For the number of anchor frame clusters, To train the total number of pedestrian bounding boxes, For the first The aspect ratio of each bounding box. For the first The aspect ratio of the center of the anchor frame. This is the Euclidean distance between the center of the bounding box and the center of the anchor box.
[0040] During the inference phase, the dynamic anchor boxes can adaptively adjust according to the scale of the feature map, and the adjustment formula is as follows:
[0041]
[0042] in, The base anchor boxes generated by clustering, This represents the feature map scale coefficient. This design allows the anchor box to flexibly adapt to feature maps of different scales, further improving the robustness and accuracy of target detection.
[0043] Furthermore, in step S3, the key point effectiveness screening is achieved through an improved weighted composite loss function, the formula of which is:
[0044]
[0045] in, , , For loss weighting coefficients, for Bounding box loss, For confidence loss, Key point coordinates loss;
[0046] The detected human key points are subjected to validity screening. Invalid key points with a confidence score of less than 0.2 are removed, and only pedestrian target samples with no less than 10 valid key points are retained. This is used to construct a purified target detection result set and enhance the validity of the results.
[0047] Furthermore, in step S4, an improved Hungarian algorithm pose matching strategy is adopted, and the bounding box is fused by combining it with the matching cost function. The matching cost function is constructed based on overlap, keypoint distance, and appearance feature similarity. The formula is as follows:
[0048]
[0049] in, , , These are the weighting coefficients. The intersection-union ratio of pedestrian bounding boxes in adjacent frames. For the effective number of human body key points and , and The first Frame and the The first frame Coordinates of key points For based on Similarity of appearance features between algorithms.
[0050] Furthermore, in step S5, the calculation of the fare evasion behavior characteristic parameters includes the calculation of coverage, time interval, and key point attitude angle. The coverage formula is:
[0051]
[0052] in, For pedestrian bounding boxes, Define the area for the turnstile. This is a function for calculating the area of a region.
[0053] The formula for the time interval is:
[0054]
[0055] in, and These are the timestamps of the nth and (n-1)th pedestrians leaving the turnstile area, respectively.
[0056] The pedestrian was deemed to have left at that time;
[0057] The formula for the key point attitude angle is:
[0058]
[0059] in, The vector representation of adjacent limbs.
[0060] Furthermore, in step S5, the behavior recognition employs a lightweight spatiotemporal graph convolutional network as the core recognition model. This network extracts behavior features through three spatiotemporal graph convolutional layers, with 64, 128, and 256 kernels in each layer, respectively. The formula for the spatiotemporal graph convolutional kernel is:
[0061]
[0062] in, For the first Frame Node The output characteristics, For nodes The set of neighboring nodes, For nodes The set of neighboring nodes, and The first Frame and the Frame Node Input features, and This represents the weight matrix for spatial and temporal convolution. It provides an effective feature representation for accurately identifying fare evasion behaviors such as tailgating, crawling, and climbing over hurdles.
[0063] Furthermore, in step S6, the fare evasion detection and early warning system judges the recognition results by setting a confidence threshold. When the confidence level of the fare evasion behavior output by the behavior recognition model is higher than the preset threshold of 0.85, the system will immediately trigger the early warning mechanism. After the early warning is triggered, the system will combine the YOLOv12 target detection results, automatically record the precise timestamp of the fare evasion behavior, and extract 5 consecutive video clips during the behavior as dynamic evidence to generate a visual screenshot of the pedestrian's movement trajectory. It will also export a structured recognition report containing key information such as detection time, pedestrian number, fare evasion behavior type, and corresponding confidence level. At the same time, visual annotation is performed. A specific colored border is used to mark the area where the fare evasion behavior occurred in the original video image, and the identified fare evasion behavior type and its confidence level value are displayed next to the annotation box, providing complete technical basis for subsequent handling.
[0064] Beneficial effects:
[0065] This invention presents a subway turnstile fare evasion early warning method that integrates target detection and behavior recognition. By preprocessing continuous video stream data from the subway turnstile area and combining it with an improved YOLOv12 model to perform target detection in the vicinity of the turnstile, it achieves fully automated processing from behavior recognition to evidence preservation. It can effectively distinguish complex fare evasion behaviors such as tailgating, crawling, and climbing, significantly reducing false alarm and false negative rates. It also possesses technical advantages such as strong real-time response capability, high recognition accuracy, and complete evidence chain, providing effective technical support for subway ticketing management and demonstrating significant potential for widespread application. Attached Figure Description
[0066] Figure 1 This is a schematic diagram of the process of the present invention.
[0067] Figure 2 This is a scene illustration of fare evasion on the subway, as described in this invention.
[0068] Figure 3 This is a test graph of the F1-confidence curve before the model of this invention was improved.
[0069] Figure 4 This is a test graph showing the accuracy-confidence curve of the model before the improvement of this invention.
[0070] Figure 5 This is a test graph showing the precision-recall curves of the model before the improvement of this invention.
[0071] Figure 6 This is a test graph of the recall-confidence curve before the model improvement of this invention.
[0072] Figure 7 This is a test graph of the F1-confidence curve of the improved model of this invention.
[0073] Figure 8 This is a test graph showing the accuracy-confidence curve of the improved model of this invention.
[0074] Figure 9 This is a test graph showing the precision-recall curve of the improved model of this invention.
[0075] Figure 10 This is a test graph of the recall-confidence curve after the model improvement of this invention. Detailed Implementation
[0076] To make the technical means, creative features, objectives, and effects of this invention easier to understand, the following description is provided in conjunction with... Figures 1 to 10 Specific embodiments are described and illustrated.
[0077] Example 1:
[0078] Combination Figure 1 This embodiment discloses a subway turnstile fare evasion warning method that integrates target detection and behavior recognition, including the following steps:
[0079] S1. Collect continuous video stream data of the subway gate area. Capture video information of the gate channel and the surrounding 1.5-meter range in real time through a high-definition camera with a resolution of no less than 1920×1080. Extract frames from the video stream at a frame rate of 30fps and perform noise reduction and size standardization preprocessing to obtain a standardized frame image with a resolution of 640×640.
[0080] S2. An improved YOLOv12 model, based on the original YOLOv12 model, is used to detect targets in standardized frame images. By introducing a channel attention module and a spatial attention module, the network and the dynamically adapted detection head are extracted, and the bounding box coordinates of pedestrian targets in the gate area, the coordinates of 25 human key points, and the confidence scores of each detection result are output simultaneously.
[0081] S3. The loss calculation module of the reconstructed and improved YOLOv12 model is improved into a weighted composite loss function. The effectiveness of the detected human key points is screened, invalid key points with confidence scores below 0.2 are removed, and pedestrian target data with completeness meeting the threshold requirements are retained to form a purified target detection result set.
[0082] S4. An improved Hungarian algorithm is used to match and track the cleaned pedestrian targets in consecutive frames. A matching cost function is constructed by combining bounding box overlap, key point distance and appearance feature similarity to adapt to the dynamics of the subway gate scene, thereby generating the complete spatiotemporal trajectory and key point sequence of each pedestrian from entering to leaving the gate area.
[0083] S5. Based on pedestrian spatiotemporal trajectory and key point sequence, extract fare evasion behavior feature parameters such as coverage, passage time interval, key point attitude angle and trajectory overlap rate, input them into a lightweight spatiotemporal graph convolutional network for behavior recognition, and determine whether there are fare evasion behaviors such as following others, crawling from below, or climbing over from above.
[0084] S6. When the confidence level of the behavior recognition result is higher than the preset threshold of 0.85, an early warning signal is immediately triggered, and evidence data such as the timestamp of the fare evasion behavior, five consecutive video frames, a visual screenshot of the pedestrian trajectory, and a recognition result report are recorded simultaneously. In step S1, YOLOv12 is introduced... The module performs noise suppression using the following formula:
[0085]
[0086] in, For the clear image after noise reduction, The original frame image containing noise. for The set of network parameters, for The mapping function;
[0087] The formula for the network loss function is:
[0088]
[0089] in, The number of training samples, For the first Noise-free, ground-label images of each sample; For the first The noisy original frame image of each sample;
[0090] Image size normalization uses a bilinear interpolation algorithm, calculating the scaled pixel by weighted averaging of the values of four adjacent pixels; let the pixel coordinates of the original image be... The scaled coordinates are The mapping relationship between the original and scaled coordinates is then:
[0091] ,
[0092] in, It is the width of the original image. It is the original image high, = =640 is the target size; It is the width of the scaled image. It is the height of the scaled image;
[0093] Pick integer part decimal part , integer part decimal part Then the scaled pixel value for:
[0094]
[0095] in, In the original image pixel values, In the original image Pixel values of adjacent points on the right, In the original image Pixel values of adjacent points on the lower side In the original image The pixel value of the adjacent point at the bottom right.
[0096] In step S2, an addition based on the existing YOLOv12 model is made. The thought-enhancing module, which combines channel attention and spatial attention, is calculated as follows:
[0097] Channel attention weight calculation:
[0098]
[0099] in, for The module outputs a feature map. for Activation function Here is the number of neurons in the hidden layer; for a two-layer perceptron, this represents 1 / 4 of the input dimension. and These are global average pooling and global max pooling operations, respectively.
[0100] Spatial attention weight calculation:
[0101]
[0102] in, This is a 3×3 convolution operation with stride 1 and padding 1. For channel concatenation operations, the results of global average pooling and global max pooling operations are merged according to the channel dimension;
[0103] Final enhanced feature map calculation:
[0104]
[0105] in, The feature map after attention enhancement is used to highlight pedestrian target features through dual channel and spatial weight modulation;
[0106] The detection head employs a dynamic anchor frame adaptation mechanism to collect pedestrian image annotation data in the turnstile area, and based on pedestrian size statistics in the subway turnstile scenario, it... The clustering algorithm regenerates 6 fitting anchor boxes, and the clustering loss function is defined as:
[0107]
[0108] in, For the number of anchor frame clusters, To train the total number of pedestrian bounding boxes, For the first The aspect ratio of each bounding box. For the first The aspect ratio of the center of the anchor frame. This is the Euclidean distance between the center of the bounding box and the center of the anchor box;
[0109] Dynamic anchor frame During the inference phase, the scale is adaptively adjusted based on the feature map, and the adjustment formula is as follows:
[0110]
[0111] in, The base anchor boxes generated by clustering. This represents the feature map scaling coefficient.
[0112] In step S3, the key point effectiveness screening is implemented based on the weighted composite loss function, and the formula is:
[0113]
[0114] in, , , For loss weighting coefficients, for Bounding box loss, For confidence loss, Key point coordinates loss;
[0115] The detected human key points are subjected to validity screening. Invalid key points with a confidence score of less than 0.2 are removed, and only pedestrian target samples with no less than 10 valid key points are retained to construct a purified target detection result set.
[0116] In step S4, an improved Hungarian algorithm is used for pose matching, and the cost function is used to fuse the bounding boxes. The cost function formula for overlap, keypoint distance, and appearance feature similarity is:
[0117]
[0118] in, , , These are the weighting coefficients. The intersection-union ratio of pedestrian bounding boxes in adjacent frames. For the effective number of human body key points and , and The first Frame and the The first frame Coordinates of key points For based on Similarity of appearance features between algorithms.
[0119] In step S5, the calculation of the fare evasion behavior characteristic parameters includes the coverage calculation formula:
[0120]
[0121] in, For pedestrian bounding boxes, Define the area for the turnstile. This is a function for calculating the area of a region.
[0122] The formula for calculating the time interval is:
[0123]
[0124] in, and These are the timestamps of the nth and (n-1)th pedestrians leaving the turnstile area, respectively. The pedestrian was deemed to have left at that time;
[0125] The formula for calculating the attitude angle of key points is:
[0126]
[0127] in, This represents the vector representation of the limbs of two adjacent pedestrians.
[0128] In step S5, behavior recognition employs a lightweight spatiotemporal graph convolutional network, extracting behavior features through three spatiotemporal graph convolutional layers. The number of convolutional kernels in each layer is 64, 128, and 256, respectively. The formula for the spatiotemporal graph convolutional kernel is as follows:
[0129]
[0130] in, For the first Frame Node The output characteristics, For nodes The set of neighboring nodes, For nodes The set of neighboring nodes, and The first Frame and the Frame Node Input features, and These are the weight matrices for spatial convolution and temporal convolution, respectively.
[0131] like Figure 2 As shown, in step S6, the system judges the recognition results by setting a confidence threshold. When the confidence level of the fare evasion behavior output by the behavior recognition model is higher than the preset threshold of 0.85, the system will immediately trigger an early warning mechanism. After the early warning signal is triggered, the system will combine the YOLOv12 target detection results, automatically record the precise timestamp of the fare evasion behavior, and extract 5 consecutive video clips during the behavior as dynamic evidence to generate a visual screenshot of the pedestrian's movement trajectory. A structured recognition report containing key information such as detection time, pedestrian number, fare evasion behavior type, and corresponding confidence level will be exported. Simultaneously, visual annotation is performed. A specific colored border is used to mark the area where the fare evasion behavior occurred in the original video image, and the identified fare evasion behavior type and its confidence level value are displayed next to the annotation box, providing complete technical basis for subsequent handling.
[0132] Example 2:
[0133] This embodiment discloses a subway turnstile fare evasion warning method that integrates target detection and behavior recognition, including the following steps:
[0134] The first step is to collect continuous video stream data of the subway gate area, then extract frames at a frame rate of 30fps, and perform noise reduction and size normalization preprocessing to obtain a normalized frame image with a resolution of 640×640; the second step is to introduce a channel attention module and a spatial attention module into the image, extract the network and dynamically adapt the detection head, and simultaneously output the bounding box coordinates of pedestrian targets in the gate area, the coordinates of 25 human key points, and the confidence scores of each detection result;
[0135] The third step is to reconstruct the loss calculation module of YOLOv12, improve the loss function to a weighted composite loss function, and perform validity screening on the detected human key points. Invalid key points with a confidence level below 0.2 are removed, and pedestrian target data with completeness meeting the threshold requirements are retained to form a cleaned set of 2000 target detection results.
[0136] The fourth step involves using an improved Hungarian algorithm to match and track pedestrian targets in a set of 2,000 target detection results. A matching cost function is constructed by combining bounding box overlap, key point distance, and appearance feature similarity to adapt to the dynamic nature of the subway gate scene, thereby generating a complete spatiotemporal trajectory and key point sequence for each pedestrian from entering to leaving the gate area.
[0137] The fifth step is to extract fare evasion behavior feature parameters such as coverage, passage time interval, key point attitude angle and trajectory overlap rate based on the pedestrian spatiotemporal trajectory and key point sequence. These parameters are then input into a lightweight spatiotemporal graph convolutional network for behavior recognition to determine whether there are fare evasion behaviors such as following others, crawling from below, or climbing over from above.
[0138] The sixth step involves using 2000 action recognition results (before and after improvement) as input data for the YOLOv12 model, respectively. Figure 3 The data before the improvement shows that the average F1 score for all categories in the F1-confidence curve ranges from 0.69 to 0.92, indicating that the overall performance of the model fluctuates significantly under different confidence thresholds. Figure 4 The precision-confidence curves before the improvement show that the average precision for all categories ranged from 0.961 to 1.00, indicating that the model was strict in judging positive samples, but may have missed detections. From... Figure 5 The precision-recall curves before the improvement show that the average precision for all categories reached 0.976, while the recall for the "human" category was only around 0.6, reflecting the model's insufficient generalization ability under occlusion or complex poses. Figure 6 The recall-confidence curves before the improvement further show that the average recall for all classes fluctuates wildly between 0.00 and 0.99, especially with a rapid drop in recall in the low confidence interval, demonstrating the model's poor robustness in identifying difficult samples. Figure 7 The improved data shows that the F1-confidence curve indicates that the average F1 score for all categories has increased to between 0.776 and 0.82, and the curve is more stable overall, demonstrating that the model maintains a high overall discriminative ability at different confidence levels. Figure 8 In the improved precision-confidence curves, the mean precision for all categories further increased to 0.993 to 1.00, approaching zero false alarms, validating the significant enhancement effect of the attention mechanism on target feature selection. Figure 9 The improved precision-recall curves show that the average precision for all categories is 0.830. Although the overall value has been adjusted, the precision for identifying key fare evasion behaviors such as "crossing," "crawling," and "tailgating" reaches 0.813, 0.860, and 0.995 respectively, better meeting the recognition needs of complex behaviors in real-world scenarios. Figure 10 The improved recall-confidence curves show that the average recall for all categories is stable between 0.00 and 0.87. The overall curves have shifted upward and fluctuated less compared to the previous version, indicating that the model's detection capability is significantly enhanced under challenges such as occlusion, small targets, and pose changes.
[0139] The above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Without departing from the spirit and essence of the present invention, those skilled in the art can make various corresponding changes and modifications according to the present invention, but these corresponding changes and modifications should all fall within the protection scope of the appended claims.
Claims
1. A method for early warning of fare evasion at subway turnstiles that integrates target detection and behavior recognition, characterized in that, Includes the following steps: S1. Collect continuous video stream data of the subway gate area, capture video information of the gate channel and surrounding set range in real time, extract frames of the video stream according to the set frame rate, and perform noise reduction and size standardization preprocessing to obtain standardized frame images. S2. Based on the original YOLOv12 model, an improved YOLOv12 model is obtained to perform target detection on standardized frame images. By introducing channel attention module and spatial attention module, the network and dynamic adaptation detection head are extracted, and the bounding box coordinates of pedestrian targets in the gate area, the coordinates of 25 human body key points, and the confidence scores of each detection result are output simultaneously. S3. The YOLOv12 model loss calculation module is reconstructed and improved. The loss function is improved to a weighted composite loss function. The effectiveness of the detected human key points is screened, invalid key points with confidence scores below 0.2 are removed, and pedestrian target data with completeness meeting the threshold requirements are retained to form a cleaned pedestrian target detection result set. S4. An improved Hungarian algorithm is used to match and track the cleaned pedestrian targets in consecutive frames. A matching cost function is constructed by combining bounding box overlap, key point distance and appearance feature similarity to adapt to the dynamics of the subway gate scene, thereby generating the complete spatiotemporal trajectory and key point sequence of each pedestrian from entering to leaving the gate area. S5. Based on the pedestrian spatiotemporal trajectory and key point sequence, extract the fare evasion behavior feature parameters such as coverage, passage time interval, key point pose angle and trajectory overlap rate, input them into a lightweight spatiotemporal graph convolutional network for behavior recognition, and finally obtain a confidence value. Based on the confidence value, determine whether there is a fare evasion behavior such as tailgating, crawling, or climbing. S6. When the confidence value of the behavior recognition result is higher than the preset threshold, an early warning signal is immediately triggered, and the timestamp of the fare evasion behavior, five consecutive video clips, a visual screenshot of the pedestrian trajectory, and a recognition result report are recorded simultaneously.
2. The subway turnstile fare evasion early warning method integrating target detection and behavior recognition according to claim 1, characterized in that, In step S1, the video stream is captured by a high-definition camera with a resolution of not less than 1920×1080, and the images of the gate channel and the surrounding 1.5-meter area are captured at a frame rate of 30fps. After noise reduction, the image size is standardized and uniformly scaled to a resolution of 640×640. Introducing YOLOv12 The module performs noise suppression using the following formula: in, For the clear image after noise reduction, The original frame image containing noise. for The set of network parameters, for The mapping function; The formula for the network loss function is: in, The number of training samples, For the first Noise-free, ground-label images of each sample; For the first The noisy original frame image of each sample; Image size normalization uses a bilinear interpolation algorithm, calculating the scaled pixel by weighted averaging of the values of four adjacent pixels; let the pixel coordinates of the original image be... The scaled coordinates are The mapping relationship between the original and scaled coordinates is then: , in, It is the width of the original image. It is the original image high, = =640 is the target size; It is the width of the scaled image. It is the height of the scaled image; Pick integer part decimal part , integer part decimal part Then the scaled pixel value for: in, In the original image pixel values, In the original image Pixel values of adjacent points on the right, In the original image Pixel values of adjacent points on the lower side In the original image The pixel value of the adjacent point at the bottom right.
3. The subway turnstile fare evasion early warning method integrating target detection and behavior recognition according to claim 1, characterized in that, In step S2, an addition based on the existing YOLOv12 model is made. The hybrid attention enhancement module, which integrates the channel attention module and the spatial attention module, is calculated as follows: Channel attention weight calculation: in, for The module outputs a feature map. for Activation function Here is the number of neurons in the hidden layer; for a two-layer perceptron, this represents 1 / 4 of the input dimension. and These are global average pooling and global max pooling operations, respectively. Spatial attention weight calculation: in, This is a 3×3 convolution operation with stride 1 and padding 1. For channel concatenation operations, the results of global average pooling and global max pooling operations are merged according to the channel dimension; Final enhanced feature map calculation: in, The feature map is enhanced with attention, and pedestrian target features are highlighted by dual channel and spatial weight modulation. The detection head employs a dynamic anchor frame adaptation mechanism to collect pedestrian image annotation data in the turnstile area, and based on pedestrian size statistics in the subway turnstile scenario, it... The clustering algorithm regenerates 6 fitting anchor boxes, and the clustering loss function is defined as: in, For the number of anchor frame clusters, To train the total number of pedestrian bounding boxes, For the first The aspect ratio of each bounding box. For the first The aspect ratio of the center of the anchor frame. This is the Euclidean distance between the center of the bounding box and the center of the anchor box; Dynamic anchor frame During the inference phase, the scale is adaptively adjusted based on the feature map, and the adjustment formula is as follows: in, The base anchor boxes generated by clustering. This represents the feature map scaling factor.
4. The subway turnstile fare evasion early warning method integrating target detection and behavior recognition according to claim 1, characterized in that, In step S3, the key point effectiveness screening is implemented based on the weighted composite loss function, the formula of which is: in, , , For loss weighting coefficients, for Bounding box loss, For confidence loss, Key point coordinates loss; The detected human key points are subjected to validity screening. Invalid key points with a confidence score of less than 0.2 are removed, and only pedestrian target samples with no less than 10 valid key points are retained to construct a purified target detection result set.
5. The subway turnstile fare evasion early warning method integrating target detection and behavior recognition according to claim 1, characterized in that, In step S4, an improved Hungarian algorithm is used for pose matching, and the cost function is used to fuse the bounding boxes. The cost function formula for overlap, keypoint distance, and appearance feature similarity is: in, , , These are the weighting coefficients. The intersection-union ratio of pedestrian bounding boxes in adjacent frames. For the effective number of human body key points and , and The first Frame and the The first frame Coordinates of key points Based on Similarity of appearance features between algorithms.
6. The subway turnstile fare evasion early warning method integrating target detection and behavior recognition according to claim 1, characterized in that, In step S5, the calculation of the fare evasion behavior characteristic parameters includes the coverage calculation formula: in, For pedestrian bounding boxes, Define the area for the turnstiles. This is a function for calculating the area of a region. The formula for calculating the time interval is: in, and These are the timestamps of the nth and (n-1)th pedestrians leaving the turnstile area, respectively. The pedestrian was deemed to have left at that time; The formula for calculating the attitude angle of key points is: in, This represents the vector representation of the limbs of two adjacent pedestrians.
7. The subway turnstile fare evasion early warning method integrating target detection and behavior recognition according to claim 1, characterized in that, In step S5, the behavior recognition employs a lightweight spatiotemporal graph convolutional network, extracting behavior features through three spatiotemporal graph convolutional layers. The number of convolutional kernels in each layer is 64, 128, and 256, respectively. The formula for the spatiotemporal graph convolutional kernel is as follows: in, For the first Frame Node The output characteristics, For nodes The set of neighboring nodes, For nodes The set of neighboring nodes, and The first Frame and the Frame Node Input features, and These are the weight matrices for spatial convolution and temporal convolution, respectively.
8. The subway turnstile fare evasion early warning method integrating target detection and behavior recognition according to claim 1, characterized in that, In step S6, when the confidence level of the behavior recognition result is higher than the preset threshold of 0.85, an early warning signal is triggered. The timestamp of the fare evasion behavior, five consecutive video clips, and the recognition results of the pedestrian trajectory visualization screenshot are exported. The corresponding video image is marked with a border of a specific color, and the fare evasion behavior type and confidence value are displayed next to the marked box. Finally, a recognition result report is generated.